简体   繁体   English

我看不到php包含页面

[英]I can't see a php include page

I have an included php page into index.html. 我有一个包含到index.html的php页面。

<?php include "inc/header.php";?>

Dreamveawer cs5 is configured for viewing via wamp server. Dreamveawer CS5配置为通过Wamp服务器查看。
On f12 I can't see this included file (only index.html is viewed, without includes) 在f12上,我看不到此包含文件(仅查看index.html,不包含)
If I open header.php itself - f12 - works well. 如果我打开header.php本身-f12,效果很好。
What could be the reason, please. 请问可能是什么原因。

index.html is an HTML file, so PHP won't be parsed. index.html是HTML文件,因此不会解析PHP。 Name the file index.php instead. 而是将文件命名为index.php

It's likely that the file cannot be located. 该文件很可能找不到。 I suspect if you change include to require , you will see a relevant error message. 我怀疑如果将include更改为require ,则会看到相关的错误消息。 You need to either change the path you are trying to include, or change your include_path variable: 您需要更改要包含的路径,或更改include_path变量:

set_include_path("/path/to/your/lib/" . DIRECTORY_SEPERATOR . get_include_path());

edit As commenters noted elsewhere, this only applies if your main file is being interpreted through PHP. 编辑正如注释者在其他地方指出的那样,这仅适用于通过PHP解释您的主文件的情况

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM