PHP 7 常量声明 const 与 define() 的区别

PHP 7 中的常量可以通过 const 关键字或 define() 函数两种方式来声明,两者之间的差别在于:

  • const 关键字会在代码编译时定义一个常量
  • define() 函数则是在代码运行时才定义一个常量

 

posted @ 2019-02-19 14:29  CodingPHP  Views(1178)  Comments(0Edit  收藏  举报