You are here: Re: Cannot instantiate non-existent class « PHP Language « IT news, forums, messages
Re: Cannot instantiate non-existent class

Posted by Oli Filth on 11/06/05 15:12

Didier Willame said the following on 06/11/2005 10:58:
>
> Janwillem Borleffs wrote:
>
>>Didier Willame wrote:
>>
>>
>>You cannot use include/include_once this way when the extension is .php as
>>it will only return the parsed result (an empty string in your case).
>>
>>What you can do, is save the class file with a .txt extension, after which
>>you would be able to include it over HTTP:
>>
>>include_once 'http://yoursite/Foo.txt';
>>$foo = new Foo;
>>$foo->hello();
>>
>>Of course, this implies that Foo.txt will be world readable, unless you
>>take precautions like shielding it with an IP based restriction.
>>
>>JW
>
>
> I have renamed the file into 'foo.txt'. Now, it's working. Thanks :) /didier


The best solution would be to *not* include the file via an HTTP
request, instead just treat it as a local file.

i.e. instead of:

include_once 'http://yoursite/Foo.txt';

use:

include_once '../inaccessible_directory_below_web_root/Foo.txt';

That way, it's impossible for anyone to access the PHP code from their
browser.


--
Oli

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация