解析错误:语法错误,意外';'

发布于 2024-08-30 13:42:08 字数 394 浏览 3 评论 0原文

我正在将我的网站从 PHP 4 迁移到 5,

但我在版本 5 服务器上不断收到此错误:

解析错误:语法错误,意外 ';'在 /var/www/vhosts/****.php 上 第1688行

当我检查代码时,它是这样的:

<?=#something here being commented out?>

这在 v4 中工作正常,但现在它创建了一个错误。我真的不明白这个错误,因为整行中的任何地方都没有 ;

我可以删除该行,但我想知道为什么这个错误首先会发生,除了追查每次发生的错误之外,我是否还能做其他事情?

谢谢!!

I am migrating my site from PHP 4 to 5

I keep getting this error on the version 5 server:

Parse error: syntax error, unexpected
';' in /var/www/vhosts/****.php on
line 1688

I when I check the code its something like this:

<?=#something here being commented out?>

This worked fine in v4 but now its creating an Error. I really do not understand the error either because there is no ; in the entire line anywhere?

I can just delete the line but I am wondering why this error is happening in the first place and if there is something else I can do besides hunting down every occurrence of that?

Thanks!!

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

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

发布评论

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

评论(3

榕城若虚 2024-09-06 13:42:08

这:

<?=#something here being commented out?>

翻译成这样:

<?php echo /*something here being commented out*/; ?>

你只需要修复我假设的语法。

This:

<?=#something here being commented out?>

Translates into this:

<?php echo /*something here being commented out*/; ?>

You just have to fix the syntax I presume.

风追烟花雨 2024-09-06 13:42:08

有一个设置可以使 成为 的简写 - 确保已启用。

There is a setting that enables <? to be shorthand for <?php - ensure that is enabled.

坚持沉默 2024-09-06 13:42:08

意想不到的';'更多地表明它不期望​​命令结束。在您的代码中,您有一个速记开放标记。你基本上是在告诉它回显,而不是在你这样做时向它传递一个参数:

<?= //comment ?>

如果你将其缩短为:

<?php //echo 'something'; ?>

你就会安全了。

unexpected ';' indicates more that it was not expecting the end of a command. In your code, you have a shorthand open tag. You're basically telling it to echo and not passing it an argument when you do:

<?= //comment ?>

If you shorten this to:

<?php //echo 'something'; ?>

You would be safe.

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