随笔分类 - php
摘要:Trait 是个什么鬼 PHP Trait 是一个抽象类, 不能实例化, 简单理解就是将trait的代码复制, 粘贴到你使用trait的类中. 和接口对比, 还是有区别的 有这么个问题. <?php class DbReader extends Mysqli { } class FileReade...
阅读全文
摘要:判断内网ip PHP 自带判断私有ip 方法 判断Mobile,还是pc
阅读全文
摘要:### PHP分页算法 ###```php 1) { $pagination .= ""; //previous button if ($page > 1) ...
阅读全文
摘要:path=rtrim($path, "/")."/"; $this -> path = ''; } /* 对图片进行缩放 * * 参数$name: 是需要处理的图片名称 * 参数$width:是缩放后的宽度 * 参数$height:是缩放后的...
阅读全文
摘要:server { listen 80; server_name www.rmd.com; root D:/Workspace/php/sites/training-cn/rmd; set $index "index.php"; ch...
阅读全文
摘要:1,创建数据表CREATE TABLE `city` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` char(64) NOT NULL, `pid` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf82.php代码
阅读全文
摘要:1.思路:用户查看物品id的时候,记录查看物品id,以及物品的其他信息,[以ID-物品信息,ID-物品信息]格式存入cookie数据库Helper:mysqlHelper.class.php host = $conf['host']; $this -> username = $conf['username']; $this -> password = $conf['password']; $this -> database = $conf['database']; $this -> conn(); $thi
阅读全文
摘要:'bpath' 实现排序(很关键) $list = $category->field(array('id','name','pid','path',"concat(path,'-',id)"=>'bpath'))->order('bpath')->select(); foreach ($list as $key => $val){ //根据排序的位置生成无限极列表的样式 for($i = 0; $i assign(&#
阅读全文
摘要:1,'name'=>'安徽','parent'=>0), array('id'=>2,'name'=>'海淀','parent'=>7), array('id'=>3,'name'=>'濉溪县','parent'=>5), array('id'=>4,'name'=>'昌平','parent'=&g
阅读全文