Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/127.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP&;关闭标记查询_Php_Html_Tidy - Fatal编程技术网

PHP&;关闭标记查询

PHP&;关闭标记查询,php,html,tidy,Php,Html,Tidy,我只是想知道为什么会这样: $config = array('wrap' => 0,'show-body-only' => TRUE,); $str = '<p>Hello World!'; $tidy = tidy_parse_string($str, $config); tidy_clean_repair($tidy); echo (htmlentities($tidy)); //outputs <p>Hello World!</p>

我只是想知道为什么会这样:

$config = array('wrap' => 0,'show-body-only' => TRUE,);

$str = '<p>Hello World!';

$tidy = tidy_parse_string($str, $config);
tidy_clean_repair($tidy);
echo (htmlentities($tidy)); //outputs <p>Hello World!</p> 
$config=array('wrap'=>0,'show-body-only'=>TRUE,);
$str='helloworld!';
$tidy=tidy\u parse\u字符串($str,$config);
整洁、清洁、维修($TIDDY);
echo(htmlentities($tidy))//输出你好,世界

但这并不是:

$config = array('wrap' => 0,'show-body-only' => TRUE,);

$str = 'Hello World!</p>';

$tidy = tidy_parse_string($str, $config);
tidy_clean_repair($tidy);
echo (htmlentities($tidy)); //outputs Hello World! 
$config=array('wrap'=>0,'show-body-only'=>TRUE,);
$str='你好,世界

",; $tidy=tidy\u parse\u字符串($str,$config); 整洁、清洁、维修($TIDDY); echo(htmlentities($tidy))//世界你好!
我相信,如果你把
放在上面,大多数程序都会接受“直到行尾”,但如果你把

放在上面,它就无法匹配它的起始位置,而忽略了它


(但我不是100%确定)

我相信,如果你把
放在一行中,大多数程序都会接受“直到行的末尾”,但如果你把
放在一行中,它就无法匹配它的起始位置,而忽略了它


(但我不是100%确定)

函数试图为您修复代码。当然,这个函数并不完美,也无法准确地猜测第二个示例中您想要写什么。所以它可能只是把它撕掉了。
tidy\u clean\u repair()
函数试图为您修复代码。当然,这个函数并不完美,也无法准确地猜测第二个示例中您想要写什么。所以它可能只是把它撕掉了

我想这是因为tidy完成了孤立的打开标记并删除了孤立的关闭标记。但我不知道为什么会这样编码。可能是因为解析时的方向。我想这是因为tidy完成了孤立的打开标签并删除了孤立的关闭标签。但我不知道为什么会这样编码。可能是因为解析时的方向。它必须回去打开那些标签。