Ben*_*nno 0 php wordpress syntax-error
我在第二行的这个函数中遇到语法错误,意外的T_STRING:
function format_date($unixtime) {
return date(“F”, $unixtime).” “.date(“d”, $unixtime).”, “.date(“Y”, $unixtime);
}
Run Code Online (Sandbox Code Playgroud)
我正在按照本教程http://tatiyants.com/how-to-use-wordpress-custom-post-types-to-add-events-to-your-site/
到目前为止,我已经按照这个字母进行了复制和粘贴.
在评论中你可以读到上面的函数丢失了,作者说要把它包含在php文件中.除了另一个人和我之外,这似乎解决了所有人.
那么问题可能与PHP或MySQL的版本有关?虽然Netbeans也说上面的代码中存在语法错误.
这是因为你从一篇写得不好的博客文章中复制并粘贴了你的代码中有无效的引号.将它们更改为单引号或双引号:
return date("F", $unixtime)." ".date("d", $unixtime).", ".date("Y", $unixtime);
Run Code Online (Sandbox Code Playgroud)
您使用的双引号是错误的:
function format_date($unixtime) {
return date("F", $unixtime)." ".date("d", $unixtime).", ".date("Y", $unixtime);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2281 次 |
| 最近记录: |