!defined('IN_TIPASK') && exit('Access Denied'); defined('IN_TBA') or exit('Access Denied!');
2012-09-29 09:33
417 查看
检查IN_TIPASK常量是否存在 如果不存在 就退出脚本 并输出Access Denied
defined() 函数检查某常量是否存在 若常量存在,则返回 true,否则返回 false。
&&符号:如果!defined('IN_TIPASK')返回的是false 他就不会执行 exit('Access Denied')
因为0&&任何数都返回false 所以程序会直接跳过后面的表达式 如果为true才会执行 exit('Access Denied')
其实可以写成这样
if(!defined('IN_TIPASK')){
exit('Access Denied');
}
<?php
define("IN_TOA","test!");
!defined('IN_TOA') && exit('Access Denied!');
defined('IN_TBA') or exit('Access Denied!');
echo IN_TOA;
?>
defined() 函数检查某常量是否存在 若常量存在,则返回 true,否则返回 false。
&&符号:如果!defined('IN_TIPASK')返回的是false 他就不会执行 exit('Access Denied')
因为0&&任何数都返回false 所以程序会直接跳过后面的表达式 如果为true才会执行 exit('Access Denied')
其实可以写成这样
if(!defined('IN_TIPASK')){
exit('Access Denied');
}
<?php
define("IN_TOA","test!");
!defined('IN_TOA') && exit('Access Denied!');
defined('IN_TBA') or exit('Access Denied!');
echo IN_TOA;
?>
相关文章推荐
- Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the ser
- [Ubuntu] Invalid command 'VirtualDocumentRoot', perhaps misspelled or defined by a module not included in the server configuration
- Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the ser
- .htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the
- .htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
- Message BT123 - Target host or target server & is not defined in an operation type
- Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applica
- Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource
- error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib
- Error: (vsim-3053) D:/adder/adder_controltb.v(60): Illegal output or inout port connection (port 'P0
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'selectcommoninfo' defined in ServletCont
- Error creating bean with name 'sessionFactory' defined in ServletContext resource
- Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Initialization of bean faile
- gdb调试时No symbol "var" defined in current context,局部变量不可查看问题
- 关于error LNK2005: "char * xxx" (?xx@@3PADA) already defined in xxx
- 解决错误Error creating bean with name 'MySessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init
- mysql 安装问题处理 Error in my_thread_global_end(): 1 threads didn't exit
- gdb调试时No symbol "var" defined in current context,局部变量不可查看问题
- Apache Error: Invalid command ‘Allow’, perhaps misspelled or defined by a module not included in the server configuration
- if(!defined('IN_ECS')){die('Hacking attempt');}