您好我想做到以下几点:如何将格式正确的HTML文档发送给客户端?
$string_foo = "Hello world!";
if (is_not_fully_html($string_foo)) {
$show = "<!doctype><html><head></head><body>{$string_foo}</body></html>";
}
$dom = new DOMDocument();
$dom->loadHTML($show);
echo $dom->saveHTML();
但是,如果$string_foo
是发生了什么:
$string_foo = "<html>Hello world!</html>";
或
$string_foo = "<body>Hello world!</body>";
或
$string_foo = "<head></head><body>Hello world!</body>";
或
$string_foo = "<head></head>Hello world!";
或
$string_foo = "<body>Hello world!";
¿如何$秀= ......................... {$ string_foo} ......将会返回一个格式良好的HTML吗?
这是一个测验?为什么不尝试使用你的PHP编译器? :o – 2013-02-18 07:11:09
不是测验!是一个问题...有这样的功能或库? – 2013-02-18 07:20:32
CrisHongKongCRISHK:@SiGateng的意思是,你为什么不尝试自己的例子?,这会告诉你发生了什么。我们希望在网站上提出这个问题,然后再询问是否确实(更清楚)你的具体编程问题是什么。到目前为止,你得到的答案质量都很低,正如你可能想象的那样。 – hakre 2013-02-18 08:18:22