Home > Backend Development > PHP Tutorial > 一个高难度的写法,老手也要胆寒一会

一个高难度的写法,老手也要胆寒一会

WBOY
Release: 2016-06-23 13:39:39
Original
1158 people have browsed it

关于双引号里面套单引的问题
准备写在如下格式里
 <script> <br /> <?php <br /> $morpic .="nnd=nnd+'<td><img src="/UploadFiles/20121116135815925.jpg" style="max-width:90%" onClick="javascript:changeimg(1)" onMouseOver="clearInterval(MyMarttt)" onMouseOut="MyMarttt=setInterval(change_img,30000)" alt="一个高难度的写法,老手也要胆寒一会" >' <br /> img1=new Image (); <br /> img1.src="/UploadFiles/20121116135815925.jpg"; <br /> url1=new Image (); <br /> url1.src="";"; <br /> ?> <br /> </script>
其中红色部分是想写的,当然了是错误的,我只是把它扔进了双引号中了,里面的单引号和双引号还没有处理,
那么如何处理呢,我试了一下用转义不行。

双引号中的内容是这个
nnd=nnd+'

一个高难度的写法,老手也要胆寒一会'
img1=new Image ();
img1.src="/UploadFiles/20121116135815925.jpg";
url1=new Image ();
url1.src="";


回复讨论(解决方案)

 $morpic .='nnd=nnd'+'<td><img  src="/UploadFiles/20121116135815925.jpg"   style="max-width:90%" onClick="javascript:changeimg(1)" onMouseOver="clearInterval(MyMarttt)" onMouseOut="MyMarttt=setInterval(change_img,30000)" alt="一个高难度的写法,老手也要胆寒一会" ></td>';
Copy after login

你用定界符就可以啦

$morpic = '';

$text =  nnd=nnd+'

一个高难度的写法,老手也要胆寒一会'
img1=new Image ();
img1.src="/UploadFiles/20121116135815925.jpg";
url1=new Image ();
url1.src="";
EOD;

$morpic .= $text;

$morpic .="[color=#008000]nnd=nnd+'

一个高难度的写法,老手也要胆寒一会'
img1=new Image ();
img1.src="/UploadFiles/20121116135815925.jpg";
url1=new Image ();
url1.src="";";[/color]

你用定界符就可以啦

$morpic = '';

$text =  nnd=nnd+'

一个高难度的写法,老手也要胆寒一会'
img1=new Image ();
img1.src="/UploadFiles/20121116135815925.jpg";
url1=new Image ();
url1.src="";
EOD;

$morpic .= $text;

我按你说的去写,但还是提示错误,难道我哪里写错了吗,
下面是我写的
$morpic .=" nnd=nnd+'一个高难度的写法,老手也要胆寒一会'
img1=new Image ();
img1.src="/UploadFiles/20121116135815925.jpg";
url1=new Image ();
url1.src="";
EOD;"
            
}
             echo $morpic;

还有一个问题
定界符里如何写变量呢
$text= nnd=nnd+'

一个高难度的写法,老手也要胆寒一会'
img1=new Image ();
img1.src="'.$smallpic.'";
url1=new Image ();
url1.src="";
EOD;
我这么写为啥不行呢
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template