[英]How to add attribute in body tag, in simpleHTMLDom
好的,这是我要在代码段中修改的标签:
<body style="; width: 100%;" class="portrait" data-promo-button="">
我不想更改它的innerHTML,但是它的样式属性。 我想将以下内容添加到样式属性:
background-color:black;
这是整个代码段中唯一的body标签。 我使用simpleHTMLDom获取内容,其中包括body标签:
function game_login($link)
{
global $options;
$ch=curl_init($link);
curl_setopt_array($ch, $options);
$content=curl_exec($ch);
echo $content;
}
我要编辑的主体标签存储在$content
变量中
提前致谢
$string =' <body style="; width: 100%;" class="portrait" data-promo-button=""> </body>';
$html = str_get_html($string);
$html->find('body', 0)->style .= 'background-color:black;';
echo $html;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.