Jump to content

variable argument in include()


jj0b

Recommended Posts

Hello,

 

I am trying to pass a variable as an argument to the include() function.

 

for example in my index.html file I have this:

 

$var = "\"page.html\"";
include($var);

 

This does not work even though the following does work:

 

include("page.html");

 

page.html is in the same directory as index.html.

 

These are the error messages that I get:

 

Warning: include("page.html") [function.include]: failed to open stream: No such file or directory in /home/username/public_html/index.html on line 27

 

Warning: include() [function.include]: Failed opening '"page.html"' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username/public_html/index.html on line 27

 

Does anyone know what would cause these errors?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/96106-variable-argument-in-include/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.