PHP 应用程序使用 = $var ?>格式...在本地不起作用
我不是一个精通 php 的人,但我几乎可以应付任何事情。我过去开发过许多 php 应用程序,但我不太记得了。作为一个朋友的恩惠,我试图帮助他们追踪 php 应用程序中的问题。我在我的机器(osx.6)php Entropy 5.3.3 apache 上设置了它。
它似乎大部分都在运行,但我在管理登录方面遇到了问题...注意到它没有登录,给出了错误或任何东西。
不管怎样,我的具体问题涉及我正在查看的一行,其中登录错误被转储到视图中:
即使我明确设置值,它也不会输出任何内容 例如:
<?php $problem="There is a problem."?>
<?= $problem ?>
但是,如果我说:
<?php $problem="There is a problem."?>
<?php echo ($problem); ?>
这让我想知道我在本地测试应用程序时遇到的问题是否是由于某些 mods 未加载或 php 版本问题造成的?
这些语法之间有什么区别,为什么一种可以工作而另一种则不行?
我试过用谷歌搜索这个...但我想我今天不太敏锐...
I'm not a huge php guy, but I can muddle through just about anything. I've worked on a number of php apps in the past, but I don't really remember much. As a favor for a friend I'm trying to help them trace a problem in a php app. I got it set up on my machine (osx.6) php Entropy 5.3.3 apache.
It seems to run for the most part, but I'm having problems with the admin login...noticed that it wasn't logging in, giving an error or anything.
Anyway, my specific question deals with a line I am looking at where login errors are dumped to the view:
This outputs nothing, even when I set the value explicity Eg:
<?php $problem="There is a problem."?>
<?= $problem ?>
However it does work if I say:
<?php $problem="There is a problem."?>
<?php echo ($problem); ?>
This makes me wonder if the problems I'm having testing the app locally are due to some mods not being loaded, or a php version issue?
What's the diff between these syntaxes, and why would one work and the other not?
I've tried googling this...but I guess I'm not really sharp today...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要启用
short_open_tag
选项。
You need to enable the
short_open_tag
option in php.ini.