For Programmers: Free Programming Magazines  


Home > Archive > PHP Mirrors > August 2007 > how to use classes in some file includes by URL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to use classes in some file includes by URL
Marcio Maia

2007-08-30, 7:34 pm

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.
Hannes Magnusson

2007-08-30, 7:34 pm

On 8/30/07, Marcio Maia <marcio@invox.es> wrote:
> 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!
>

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


Did you forget to read that page?
"If you have a problem or suggestion in connection with the PHP.net
website or mirror sites, please contact the webmasters. If you have
problems setting up PHP or using some functionality, please ask your
question on a support channel detailed above, the webmasters will not
answer any such questions."

-Hannes
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com