Home  >  Article  >  Backend Development  >  各位老大,帮忙检查一下语法吧,关于引号的用法,难煞小弟!解决办法

各位老大,帮忙检查一下语法吧,关于引号的用法,难煞小弟!解决办法

WBOY
WBOYOriginal
2016-06-13 13:42:44771browse

各位老大,帮忙检查一下语法吧,关于引号的用法,难煞小弟!
我打算用PHP输出一段 XML,有一句总是出错,语法不对!

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->$strXML .= "<set name='"date_format($row["DatePro"],' value='".$row["Quantity"]."' hovertext=""></set>";


请指教,多谢了!!

------解决方案--------------------
PHP code


date_format($row["DatePro"],'%Y-%m')
这个两边少了连接符
<br><font color="#e78608">------解决方案--------------------</font><br>$strXML .= "<set name='" . date_format($row["DatePro"],' . value='" . $row["Quantity"] . "' hovertext=""></set>";<br>
<br><font color="#e78608">------解决方案--------------------</font><br>date_format对于参数,是有格式要求的,,你翻手册<br><br><br>可以尝试下,date_format(date_create($row["DatePro"]),'%Y-%m')
<br><font color="#e78608">------解决方案--------------------</font><br>date_format 的第一个参数应该是 DateTime 类型数据
<br><font color="#e78608">------解决方案--------------------</font><br>我看了下函数说明,加上$date = date_create($xxx); 看看 ,前面1万米已经说了<br>
<br><font color="#e78608">------解决方案--------------------</font><br>
PHP code

strtotime("Y-m-d H:i:s")//输出时间戳格式
date("Y-m-d H:i:s",time())//把时间戳格式输出成2011-02-1 12:0:0 格式 <div class="clear">
                 
              
              
        
            </div>
Statement:
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