Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.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 will print&;amp&;规则;_Php - Fatal编程技术网

Php will print&;amp&;规则;

Php will print&;amp&;规则;,php,Php,我想在我的php页面中使用®(®)。 作为$var='test.®.'title'尝试获取站点错误。如何在php中将其与字符串一起使用 php页面中的HTML字符实体 $vars['head_title'] = 'test'.htmlentities('®').'string title'; 输入输出将得到test&&规则;字符串标题 如何在php中使用保留符号您试图错误地使用htmlentities,摘自: 此函数在所有方面都与htmlspecialcha

我想在我的php页面中使用®(®)。 作为
$var='test.®.'title'尝试获取站点错误。如何在php中将其与字符串一起使用

php页面中的HTML字符实体

   $vars['head_title'] = 'test'.htmlentities('®').'string title';
输入输出将得到
test&&规则;字符串标题

如何在php中使用保留符号

您试图错误地使用
htmlentities
,摘自:

此函数在所有方面都与htmlspecialchars()相同,除了HTMLEntity()之外,所有具有HTML字符实体等价物的字符都会转换为这些实体

如果您想解码(反之),可以使用html_entity_decode()

你想要相反的结果,:


您不需要使用htmlentities函数,您可以直接打印它,如下所示:-

$vars['head_title'] = "test ® string title";

您如何输出
$vars['head\u title']
?是的,输出head\u title,但如何。。。。。。。。。。在drupal模板中,
htmlentities('®;')
毫无意义<代码>®
是一个html实体。为什么要将at编码为html实体?已经是了。只需
echo'®;'做你想要的。
$vars['head_title'] = "test &reg; string title";