<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>https://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>https://jackxiang.com/post//</link>
<title><![CDATA[php echo eval变量计算问题]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Sat, 10 Oct 2009 07:45:22 +0000</pubDate> 
<guid>https://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	务必注意如下：<br/><div class="code">配对标记名的结尾标记名应单独一行，前后均不允许输出字符...(例如空格等不可见但存在的字符..)</div><div class="code"><br/><br/>开始：<br/>&lt;?php<br/>$countwis = 21;<br/>$ishper4 = 100;<br/>$countwish4 = 128;<br/>$countwishper4 = 666;<br/>echo &lt;&lt;&lt;EOF<br/>&lt;/li&gt; &lt;li&gt;&lt;span class=&quot;lb&quot;&gt;其他:&lt;/span&gt;&lt;span class=&quot;scale blue&quot;&gt;&lt;img src=&quot;images/vote_blue.gif&quot; width=eval($countwishper4*2.35) height=&quot;8&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;scalenum&quot;&gt;&#123;$countwish4&#125;((&#123;$countwishper4&#125;%)&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;<br/>EOF;<br/><br/><br/>?&gt;<br/></div><br/><br/>run：<br/><br/>jackxiang@Tencent:~/php&gt; /usr/local/php/bin/php eval.php <br/>PHP Warning:&nbsp;&nbsp;Module &#039;sockets&#039; already loaded in Unknown on line 0<br/>&lt;/li&gt; &lt;li&gt;&lt;span class=&quot;lb&quot;&gt;其他:&lt;/span&gt;&lt;span class=&quot;scale blue&quot;&gt;&lt;img src=&quot;images/vote_blue.gif&quot; width=eval(666*2.35) height=&quot;8&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;scalenum&quot;&gt;128((666%)&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;<br/><br/>why：<br/>width=eval(666*2.35) <br/><br/>我是想让php计算出来给width的，为什么？？？<br/><div class="code"><br/>&lt;? <br/>if(test case) <br/>print&lt;&lt;&lt;EOT <br/>&lt;....html code....&gt; <br/>EOF; <br/>else <br/>print&lt;&lt;&lt;EOT <br/>&lt;....html code....&gt; <br/>&nbsp;&nbsp; EOF; //没有顶格写会报错：Parse error: syntax error, unexpected $end in<br/>?&gt; <br/></div><br/><br/>如上写法是不可以的，需要把EOF标识符顶格：<br/><div class="code"><br/>&lt;? <br/>if(test case) <br/>print&lt;&lt;&lt;EOT <br/>&lt;....html code....&gt; <br/>EOF; <br/>else <br/>print&lt;&lt;&lt;EOT <br/>&lt;....html code....&gt; <br/>EOF; <br/>?&gt;<br/></div><br/><br/><br/>补充上月票哥的：<br/><br/>&lt;&lt;&lt;EOT，这个后面不能有空格<br/>EOT;首先，要顶格，其次，分号后不能有空格。<br/><br/>定界符这个东西功能很强大，特别是在引用多行HTML代码的时候，方便了PHP的开发者，但其实他的使用很妖异【没装过PHP5.3，所以不知道新的有没有变化】<br/><br/>1、heredoc syntax 里面只能是文字，凡是涉及到的变量都会被解析<br/><br/>2、不要妄想在定界符内赋值、计算等，如果是变量的相乘，请在外面解析完了放进来。。。<br/><br/>3、大括号要注意着使用，无论如何，大括号内不要同时出现多个变量<br/><br/>4、定界符标志后面不能有任何空格，如 &lt;&lt;&lt;EOT，EOT;，这两个符号后都不能有任何字符，EOT;就是占一行，谁也不能抢它<br/><br/>就想到这么多。以后想到再写<br/><br/>顺便说明一下，PHP的文件还是有规范的。。<br/><a href="https://jackxiang.com/attachment.php?fid=29" target="_blank"><img src="https://jackxiang.com/attachment.php?fid=29" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>例如<br/><br/>1、空文件，一般代码为&lt;?php，如果就这样写，肯定报错，最少在&lt;?php后面得加一个空格<br/><br/>2、文件结尾，上面说的定界符，就是一例，如果文件正好是EOT;结尾，后面又没有 ?&gt; ，文件绝对报错，所以必须要在EOT;后再敲一个回车。。。。<br/><br/>妖啊。。实在是妖啊。。<br/><br/><br/><br/>彪哥的url：<br/>http://www.neatcn.com/show-924-1.shtml
]]>
</description>
</item><item>
<link>https://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] php echo eval变量计算问题]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>