为什么 PHP 不解析我的脚本?

发布于 2024-07-19 07:12:12 字数 251 浏览 7 评论 0原文

我正在尝试获取 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

孤君无依 2024-07-26 07:12:12

确保您的 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.

水溶 2024-07-26 07:12:12

另一种选择可能是尝试使用 -f 命令行选项。

php -f c:\test.php

Another option might be to try using the -f command line option.

php -f c:\test.php
年华零落成诗 2024-07-26 07:12:12

我已经有一段时间没有从命令行运行 php 了,但是试试这个:

<?php
echo 'hello!';
?>

It's been a while since I've ran php off the command line, but try this:

<?php
echo 'hello!';
?>
毁梦 2024-07-26 07:12:12

还要确保您的网络服务器配置正确。 如果未将其配置为通过 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文