Home >Backend Development >PHP Tutorial >php中const与define的差别

php中const与define的差别

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 10:56:33750browse

php中const与define的区别

(1)define不能定义在类中,而const必须定义在类中,并且const必须通过类名::变量名来进行访问;

(2)两者都是不能进行重新赋值

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:PHPExcel读取excel资料