为什么当我在浏览器中查看PHP时,我的PHP似乎被注释掉了? <! - ?php include(" header.php"); ? - > [英] Why does my PHP appear to be commented out when I view it in the browser? <!--?php include("header.php"); ?-->

查看:142
本文介绍了为什么当我在浏览器中查看PHP时,我的PHP似乎被注释掉了? <! - ?php include(" header.php"); ? - >的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个html页面,但希望将头部分开,所以我不必更改所有文件。

我试图添加一个php.include文件,并将这些页面保存为.php文件。



由于某些原因,当我查看header.php文件时,文件没有显示在我的文件中。

这里是我的代码。这是正确的方式吗?

 <!DOCTYPE html> 

< html lang =en>

< head>
< meta charset =utf-8/>
< title> Chartego |通过出色的图片和视频创建具有社交气息的人< / title>

< meta http-equiv =content-typecontent =text / html; charset = utf-8/>

< / head>
< body>

<?php include'header.php'; ?>


< div id =wrap-inner>
content
< / div>







<

当我使用chrome检查元素时,php似乎被注释掉了


在进入浏览器之前,PHP没有通过PHP解析器,因此浏览器正在接收PHP代码,而不是服务器执行它。



请确保:


  • 您正在通过HTTP加载页面(例如,不是双击文件管理器中的文件)

  • 您使用的服务器支持PHP

  • 服务器配置为将文件视为PHP(通常通过给它一个。 php文件扩展名)


I am building a html page but want to break the header out so I dont have to keep changing all the files.

I am attempting to add a php.include file and save the pages out as .php files.

For some reason the header.php file is not showing in my file when i view it.

here is my code. Is this the correct way??

<!DOCTYPE html>

<html lang="en">

    <head>
    <meta charset="utf-8" />
    <title>Chartego | Creating Socially Inflential People with great images and videos</title>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

</head>
<body>

<?php include 'header.php'; ?>


  <div id="wrap-inner">
content
</div>

解决方案

when i inspect the element using chrome the php seems to be commented out

The PHP is not passing through a PHP parser before getting to the browser, so the browser is receiving the PHP code instead of the server executing it.

Make sure that:

  • You are loading the page over HTTP (e.g. not just double clicking the file in your file manager)
  • The server you are using supports PHP
  • The server is configured to treat the file as PHP (this is usually done by giving it a .php file extension)

这篇关于为什么当我在浏览器中查看PHP时,我的PHP似乎被注释掉了? &lt;! - ?php include(&quot; header.php&quot;); ? - &GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆