Mac中Composer的安装和使用 Composer 是 PHP5.3以上 的一个依赖管理工具。你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer 会安装这些依赖的库文件。它仅仅是一个依赖关系的管理,如同在iOS开发中Swift 和 Objective-C工程中使用的CocoaPods一样。安装composer安装前需确保系统PHP版本在5.3以上,在终端中执行以下命令下载Composer可执...
php 根据身份证号返回性别 // 根据身份证号 识别男女 1:女 2:男function get_sex($idCard){ $position = (strlen($idCard) == 15 ? -1 : -2); if (substr($idCard, $position, 1) % 2 == 0) { return 1; } return 2;}...
PHP 返回随机字符串 public function random($length = 8){ $chars = 'abcdefghijklmnopqrstuvwxyz0123456789'; $string = ''; for ($i = 0; $i < $length; $i++) { $string .= $chars[mt_rand(0, strlen($ch...
PHP 记录错误日志 <?phpnamespace Pharest\Register;class Logger{ protected $date; protected $time; protected $path; /** * Logger constructor. * * @param \Pharest\Config $config...