首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

php字符串的简单有关问题

2012-10-31 
php字符串的简单问题现在有很长的一串html代码,比如:!DOCTYPE html!--[if IE 6]html idie6 dirl

php字符串的简单问题
现在有很长的一串html代码,比如:

<!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" dir="ltr" lang="zh-CN">
<![endif]-->
<!--[if IE 7]>
<html id="ie7" dir="ltr" lang="zh-CN">
<![endif]-->
<!--[if IE 8]>
<html id="ie8" dir="ltr" lang="zh-CN">
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html dir="ltr" lang="zh-CN">
<!--<![endif]-->
<head>
<meta charset="UTF-8" />
。。。。。。。


我想把它赋值给一个php变量,该怎么写?

我写:

<?
$a = 。。。(上述的html代码)
?>


出错,求解。


不要说把这段html转义,因为很长,不太可能一个一个字符转义

[解决办法]
$a =<<< TXT
<!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" dir="ltr" lang="zh-CN">
<![endif]-->
<!--[if IE 7]>
<html id="ie7" dir="ltr" lang="zh-CN">
<![endif]-->
<!--[if IE 8]>
<html id="ie8" dir="ltr" lang="zh-CN">
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html dir="ltr" lang="zh-CN">
<!--<![endif]-->
<head>
<meta charset="UTF-8" />
......
TXT; //这里必须顶格写

热点排行