所以我正在学习PHP,以及我学习phpfox更复杂的标准。 我遇到的一个问题是用几行代码 - 我得到他们做的。但我不明白他们为什么以这种方式构建。有人可以解释吗?学习PHP - 有人可以解释这个如果陈述吗?
在下面的代码行中的if语句由{}走投无路而不是通常的:
if thing('condition') {
do stuff
}
方式,我很熟悉。为什么是这样?
{if Phpfox::isUser() && !PHPFOX_IS_AJAX && $sCustomViewType === null}
{if (Phpfox::getUserBy('profile_page_id') > 0 && defined('PHPFOX_IS_USER_PROFILE'))
|| (isset($aFeedCallback.disable_share) && $aFeedCallback.disable_share)
|| (defined('PHPFOX_IS_USER_PROFILE') && !Phpfox::getService('user.privacy')->hasAccess('' . $aUser.user_id . '', 'feed.share_on_wall'))
|| (defined('PHPFOX_IS_USER_PROFILE') && !Phpfox::getUserParam('profile.can_post_comment_on_profile'))
}
{else}
另外什么是::的事情?当我看到(而不是在这)a |本身,这是干什么的?
非常感谢您的帮助:)
这是谜语时间对我来说:) [符号的 – Sarfraz
可能重复 - 这是什么符号在PHP中意味着什么?](http:// stackoverflow。com/questions/3737139/reference-what-does-this-symbol-mean-in-php) – NikiC
我的猜测是,kooky PHP语法可能是某种模板语言,尽管我不认识它。你还应该看看[范围解析运算符'::'](http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php)和[按位或运算符'|'](http ://php.net/manual/en/language.operators.bitwise.php)。 – lonesomeday