开发者

Virtual function - including some html

I have a php-file which includes another html-file:

<? virtual("../top.html");?>

The problem is that any code before this include compiles and runs well, after - nothing. There aren't any errors etc. After commenting th开发者_如何学Gois line, everything works.

Code was written under local computer with ArchLinux + LAMP. Now I have ubuntu 10.04 with the same configuration.

What could it be?


You might try changing top.html to top.phtml and using require_once.

<?php require_once('../top.phtml'); ?>


If you just want to pass some html from a file into your output, you could also use:

<?php echo file_get_contents('../top.html'); ?>

That way, you stay independent of the underlying webserver and you make sure, that no php code that may be in the html is being executed.

However if you wish something in there to be executed, you can use require_once() as stated by Jeremy.


Can you check error log of the Apache?

Also, you should use

<?php virtual("../top.html");?>

if your php.ini has short_open_tag = Off.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜