|
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]
|