作用:defined检查某个名称的常量是否存在。

语法:bool defined ( string $name )。

补充说明:

1.如果你要检查一个变量是否存在,请使用 isset()

2.defined() 函数仅对 constants 有效。

3.如果你要检测一个函数是否存在,使用 function_exists()。

 

案例:

if ( ! defined('BASEPATH')) 
exit('No direct script access allowed'); 判断常量BASEPATH是否定义

 

 

相关文章:

  • 2021-11-13
  • 2021-08-28
  • 2022-12-23
  • 2021-08-20
  • 2021-10-07
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
猜你喜欢
  • 2021-10-07
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案