为什么在一台计算机上工作但不能在另一台计算机上工作?

发布于 2024-09-14 16:14:25 字数 701 浏览 2 评论 0原文

当我在我的电脑上写入时,

<?=?>

它不起作用,但在另一台电脑上却可以工作!为什么 ??? :( 例如:

<?php
$courses = CourseManager::findAll();
?>
<h3>Course List</h3>
<table>
    <tr><th>Name</th></tr>
 <?php   foreach ($courses as $c){
?>
    <tr>
        <td><?=$c->getName()?></td></tr>
  <?php } ?>

</table>

或者这个,这太简单了不是吗? :)

<?= expression ?>

的快捷方式:)

<? echo expression ?>

这是或

<?php
$i ="test";
?>

<h1><?=$i?></h1>

感谢您的建议

When I write

<?=?>

in my PC it's not working,but it's work in another PC !!! why ??? :(
for example :

<?php
$courses = CourseManager::findAll();
?>
<h3>Course List</h3>
<table>
    <tr><th>Name</th></tr>
 <?php   foreach ($courses as $c){
?>
    <tr>
        <td><?=$c->getName()?></td></tr>
  <?php } ?>

</table>

or this, it's too simple no ? :)

<?= expression ?>

This is a shortcut for

<? echo expression ?>

or

<?php
$i ="test";
?>

<h1><?=$i?></h1>

Thanks for your advice :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

江南烟雨〆相思醉 2024-09-21 16:14:26

您没有启用短标签。

要启用它们,请在 php.ini 中查找 short_open_tag。将其更改为“On”并重新启动 Apache。

You don't have the short tags enabled.

To enable them look for short_open_tags in php.ini. Change it to "On" and restart Apache.

在梵高的星空下 2024-09-21 16:14:26

PHP 的 short_open_tag 选项在不同的服务器上并不相同。如果可能,请避免使用这些类型的开始标签。

如果您想确保短开放标签可用,请使用 ini_set 自行设置

PHP's short_open_tag options isn't the same on different servers. If possible avoid to use these type of opening tags.

If you want to be sure short open tags are available, set it yourself with ini_set.

ヅ她的身影、若隐若现 2024-09-21 16:14:26

因为这些快捷方式可以在php.ini中关闭。 该选项称为 short_open_tags.

Because these shortcuts can be turned off in the php.ini. The option is called short_open_tags.

内心旳酸楚 2024-09-21 16:14:26

检查 php.ini 中的 short_open_tag

Check short_open_tag in php.ini

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