PHP代码解析错误 [英] PHP code parse error
问题描述
您好,
在EW2中编写php代码编写xml文件时,我发现代码编辑器出错了。或者至少我认为这是一个错误。什么时候写?>在字符串文字中,代码编辑器停止将其视为字符串文字。但是,执行的代码在服务器上运行且没有错误。这是一个例子。
<前lang = x-js><?php
echo" this \"?> \ "使编辑器表现得很时髦"> ;;
echo"我在编写php代码时发现了这个错误来创建RSS内容";
echo"是否有人能提供见解?";
echo"如果我使用它来逃避它?\>然后它工作正常。但是,在编写xml文件时,\\会在标记中结束,并创建无效的订阅源";
echo" example" ;;
echo" fwrite($ file,\"<?xml version = \" 1.0 \"?> \");" ;;
?>
转义这样的字符?\>使代码编辑器工作正常,但它会写?\>到文件,这会产生无效的xml标头。我认为编辑认为?>表示php部分的结尾,它错误地查找字符串文字
谢谢,
这是一个已知问题。
Hello,
while writing php code in EW2 to write an xml file, i discovered an error with the code editor. Or at least I percieve it as an error. when writing a ?> in a string literal, the code editor stops considering it as a string literal. However, the executed code runs on the server with no errors. Here is an example.
<?php
echo "this \"?>\" causes the editor to act funky">;
echo "I discovered this error while writing php code to create RSS content";
echo "can anyone offer insight?";
echo "how ever if i escape it using ?\> then it works ok. however, when writing the xml file, the \\ ends up in the tags and creates an invalid feed";
echo "example";
echo "fwrite($file, \"<?xml version=\"1.0\" ?>\");";
?>
Escaping the characters like this ?\> makes the code editor work ok, but it will write ?\> to the file, which makes an invalid xml header. I think the editor considers the ?> to mean the end of the php section, and it incorrectly looks in string literals
Thanks,
Its a known issue.
这篇关于PHP代码解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!