how to use classes in some file includes by URL
| From: | Marcio Maia | Date: | Thu, 30 Aug 2007 12:19:14 +0000 |
| Subject: | how to use classes in some file includes by URL | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-36325@lists.php.net to get a copy of this message | ||
The support bug, tell me that you can help me!!
Pleass tell me how can I use classes and functions in some file includes by URL.
All folders in my project are maped with URL direction!
thanks a lot!
Description:
------------
With the parameters "allow_url_fopen" = "on" and "allow_url_include" =
"on" I can include URL like files, but I cannot declare the classes and
cannot use the functions declared in the include file...
Reproduce code:
---------------
/* FILE PHPbug.php */
<?php
// "allow_url_fopen" and "allow_url_include" is "on"
define("DIR", "http://localhost:8080/MyClass.php" <http://localhost:8080/MyClass.php%22>);
require_once(DIR);
$bug = new MyClass(); //ERROR, dont found the class...
echo $bug->getNumber();
echo "<br>";
echo callFunction(); //ERROR, dont found the function...
?>
/* FILE MyClass.php */
<?php
class MyClass {
public function getNumber() { return 100; }
}
function callFunction() { return "ok";}
?>
Expected result:
----------------
I expect...
100
ok
Actual result:
--------------
Fatal error: Class 'MyClass' not found in
C:\MARCIO\public_html\PHPbug.php on line 11
*[30 Aug 12:03pm UTC] jani@php.net*
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.