上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 36 下一页
摘要: __get 对象访问受保护的属性,私有属性时,会触发__get魔术方法 <?php class Person{ //公有属性 public $name; //受保护属性 protected $age; //私有属性 private $sex; //对象访问age,sex属性会访问这个方法 publi 阅读全文
posted @ 2021-07-03 07:28 胡勇健 阅读(221) 评论(0) 推荐(0)
摘要: mvc目录结构 /mvc - app - constroller - IndexController.php - model - StudentModel.php - view - index.tpl - students.tpl - config - config.php - core - App 阅读全文
posted @ 2021-07-02 15:16 胡勇健 阅读(173) 评论(0) 推荐(0)
摘要: 常用的设计模式:单例模式,工厂模式,观察者模式,适配器模式,依赖注入等 单例模式 //单例设计模式 class Singleton { //单例对象 private static $instance; private function __construct() { } public static 阅读全文
posted @ 2021-07-02 04:55 胡勇健 阅读(151) 评论(0) 推荐(0)
摘要: smarty安装 composer下载smarty composer require smarty/smarty 导入smarty,并创建smarty对象 //引入Smarty.class.php require_once('../vendor/smarty/smarty/libs/Smarty.c 阅读全文
posted @ 2021-07-01 17:36 胡勇健 阅读(680) 评论(0) 推荐(0)
摘要: 使用intervention/image图片库进行图片操作 图片验证码 <?php //导入autoload.php自动加载 require '../vendor/autoload.php'; //导入ImageManager类 use Intervention\Image\ImageManager 阅读全文
posted @ 2021-06-29 17:58 胡勇健 阅读(801) 评论(0) 推荐(0)
摘要: 官网 http://image.intervention.io 安装 composer require intervention/image 用法 //导入autoload.php自动加载 require '../vendor/autoload.php'; //导入ImageManager类 use 阅读全文
posted @ 2021-06-29 07:06 胡勇健 阅读(828) 评论(0) 推荐(0)
摘要: 安装分页类库 composer require "jasongrimes/paginator:~1.0" 用法 index.php <?php require '../vendor/autoload.php'; use JasonGrimes\Paginator; $totalItems = 500 阅读全文
posted @ 2021-06-28 14:22 胡勇健 阅读(50) 评论(0) 推荐(0)
摘要: 封装验证码类 /Code.php <?php /** * 验证码类 * 使用方法 * $code = new Code(); * $code->outImage();//输出验证码图片 * $code->code; // 获取验证码字符串 */ class Code{ //验证码个数 protect 阅读全文
posted @ 2021-06-28 07:01 胡勇健 阅读(139) 评论(0) 推荐(0)
摘要: pdo链接MySQL数据库 /1.php <?php //链接mysql数据库 $config = [ 'host'=>'127.0.0.1', 'user'=>'root', 'password'=>'root', 'database'=>'php', 'charset'=>'utf8' ]; $ 阅读全文
posted @ 2021-06-28 05:22 胡勇健 阅读(649) 评论(0) 推荐(0)
摘要: PSR-4 composer.json { "name": "huyongjian/php", "autoload": { "psr-4": { "Huyongjian\\": "Huyongjian/", "Huyongjian\\Controller\\": "Huyongjian/Contro 阅读全文
posted @ 2021-06-27 15:39 胡勇健 阅读(69) 评论(0) 推荐(0)
上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 36 下一页