简体   繁体   English

PHP在浏览器中显示标签?

[英]PHP displaying tags in browser?

When I create a php file and try to echo something to the browser I get back everything including the code that shouldn't be displayed. 当我创建一个php文件并尝试在浏览器中回显某些内容时,我会取回所有内容,包括不应显示的代码。 I'm wondering if I have turned off a Apache modules or something. 我想知道我是否已经关闭了Apache模块或其他东西。 Does anyone have any idea ? 有人有什么主意吗 ? the example below display. 下面的示例显示。 The PHP tags and the echo command. PHP标记和echo命令。

file:///C:/wamp/www/Training/text.php 文件:/// C:/wamp/www/Training/text.php

<?php

echo "Anthing";

?>

I think you are typing file location in browser. 我认为您正在浏览器中键入文件位置。 You must use your local web-server address. 您必须使用本地Web服务器地址。 Try typing this in URL bar of browser. 尝试在浏览器的URL栏中键入此内容。

localhost/Training/text.php 本地主机/培训/text.php

You need to access your file by a webserver path. 您需要通过网络服务器路径访问文件。 Like 127.0.0.1/Training/text.php or localhost/Training/text.php . 127.0.0.1/Training/text.phplocalhost/Training/text.php

If you are accesing this file like file:///C:/wamp/www/Training/text.php , browser will not know how to execute <?php tags. 如果您要访问文件file:///C:/wamp/www/Training/text.php类的file:///C:/wamp/www/Training/text.php ,则浏览器将不知道如何执行<?php标签。

The URL itself file:///C:/ indicates that the file itself is being displayed, not the output. URL本身file:///C:/表示正在显示文件本身,而不是输出。 Start your webserver and point your browser to http://localhost/Training/text.php 启动您的网络服务器,然后将浏览器指向http://localhost/Training/text.php

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

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