为什么 PHP 不解析我的脚本?
我正在尝试获取 php 可执行文件来解析脚本,但它不起作用。 我运行这样的东西:
php c:\test.php
和 test.php 包含以下内容:
<?
echo 'hello!';
?>
这正是运行命令返回的内容。 它返回原始代码。 我怎样才能让它真正解析代码并返回“hello!” 反而?
I'm trying to get the php executable to parse scripts, but it's not working. i run something like this:
php c:\test.php
and test.php contains this:
<?
echo 'hello!';
?>
and that is exactly what running the command returns. It returns the raw code. How can I get it to actually parse the code and return "hello!" instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
确保您的 php 中启用了 short_open_tag 设置。 ini.ini。 如果做不到这一点,请使用稍长的
来启动脚本。
Make sure you have the short_open_tag setting enabled in your php.ini. Failing that, use the ever-so-slightly longer
<?php
to start your script.另一种选择可能是尝试使用 -f 命令行选项。
Another option might be to try using the -f command line option.
我已经有一段时间没有从命令行运行 php 了,但是试试这个:
It's been a while since I've ran php off the command line, but try this:
还要确保您的网络服务器配置正确。 如果未将其配置为通过 php 解释器运行 .php 页面,它可能只是显示为文本文件。
Also make sure that your webserver is correctly configured. If it is not configured to run .php pages through the php interpreter it may simply display as a text file.