问题描述
在标题中,在我的html5文档中,由于误读->作为结束标记,php脚本结束得太早。我不知道为什么?我正在使用Adobe Dreamweaver。
As in title, in my html5 document, php script is ending too early, due to misreading -> as a closing tag. I have no idea why? I'm using Adobe Dreamweaver.
<?php
define('IN_PHPBB', true);
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$user -> session_begin();
$auth -> acl($user = data);
$user -> setup();
?>
这不仅是突出显示错误,而且删除空格也没有区别。将session_begin()更改为session_start()仍然没有。我可以看到
It's not just highlighting error, and removing spaces makes no difference. Changed session_begin() to session_start() still nothing. I can see lines
session_start(); $auth->acl($user = data); $user->setup(); ?>
在我的网站上。
问题是,我的文件是.html文件;>感谢您的答复
The problem was, my file was a .html file ;> Thanks for replies
推荐答案
简短版本:不是。 PHP终止于?>
(如果使用的是ASP样式标记,则可能终止于%>
)。
Short Version: It's not. PHP terminates at ?>
(or possibly %>
if you're using asp style tags).
长版:浏览文档,尝试在周围放置各种echo语句,以确保退出当前的位置。如果可以的话,请使用纯文本查看器编辑文件,以确保编辑器不会对您隐藏任何内容。
Long Version: Take a look through your document, try placing various echo statements around to ensure you're exiting where you think you are. Edit the file with a plain text viewer if you can, to make sure your editor isn't hiding anything from you.
更新
确保您的include正确执行。如果找不到该文件,或者该文件未创建 user
对象,则下一行将失败,PHP将终止。
UpdateEnsure that your include is performing correctly. If it's unable to find that file, or the file doesn't create the user
object, your next line will fail, and PHP will terminate.
这篇关于为什么<?php标签在$ user上关闭->的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!