Created
May 21, 2018 08:46
-
-
Save HavenShen/c42a5762fa8692aed7a571fad2016c59 to your computer and use it in GitHub Desktop.
可定义数组常量。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| 数组常量 | |
|-------------------------------------------------------------------------- | |
| | |
| 可定义数组常量。 | |
| | |
*/ | |
// PHP 7 之前 | |
define('name', 'Haven Shen'); | |
echo NAME; | |
// PHP 7 之后 | |
define('ALLOWED_FILE_EXTENSIONS', [ | |
'png', | |
'jpg' | |
]); | |
var_dump(in_array('jpg', ALLOWED_FILE_EXTENSIONS)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment