Home  >  Article  >  Backend Development  >  这样写是不是矛盾哈

这样写是不是矛盾哈

WBOY
WBOYOriginal
2016-06-23 13:34:051384browse

defined('THINK_PATH') or exit();
我的理解是:如果定义了THINK_PATH就执行,或者是退出。
那么问题来了,如果真定义了,他是执行还是退呢,因为这里是or的关系。太矛盾了,让计算机啥整。听谁的


回复讨论(解决方案)

逻辑或表达式 自左向右检查,只要有一项成立就结束,后面的不在判断了
这就是 逻辑或表达式 的 短路效应

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
Previous article:超级新手求PHP最简单问题Next article:php短标签