05 2016 档案
摘要:1. 停止WAMP服务器. 2. 去网站windows.php.net 下载php-5.4.31-nts-Win32-VC9-x86.zip(32位的). 不要下载THE INSTALLER. 3. 在wamp/bin/php创建php5.4.31文件夹 4. 把下载的zip包解压到php5.4.3
阅读全文
摘要:Windows下的Memcache安装:1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:memcached2. 在终端(也即cmd命令界面)下输入 ‘c:memcachedmemcached.exe -d install' 安装3. 再输入: ‘c:memcachedm
阅读全文
摘要:新换了台电脑,一个mac,特蛋疼的各种环境安装。两个多小时,总算把开发环境配好了。 XAMPP就不用说了,phpstorm(javaEE 6.0),navicat for mysql ,一堆的注册码,破解版能找到人头痛。总算处理OK了。 下面说正事。 YII下载后,composer安装不上去,YII
阅读全文
摘要:static(关键字) 类似于 self(关键字) , 但它指向的是被调用的类(Document) 而不是包含类(DomainObject) , static 和 self 的区别: 以前你这么写: 现在这么写 好处: 可以节省大量重复代码~
阅读全文
摘要:文件 frontend/libs/FilterTest.php frontend/controllers/TestbehaviorController.php
阅读全文
摘要:案例如下 common/widgets/TopMenu.php(地址可以自定义位置,命名空间一定要对应) 视图 menu.php 控制器
阅读全文
摘要:在比较特殊的情况下YII的防止跨站攻击也会失效 YII针对XSS输入
阅读全文
摘要:以/开头表示跳出当前控制器 例如 而以//开头表示跳出当前应用模块
阅读全文
摘要:YII在模型中定义场景后 在控制器中调用场景时,场景定义之外的字段会在操作时被过滤掉 scenarios() 方法默认实现会返回所有yii\base\Model::rules()方法申明的验证规则中的场景, 当覆盖scenarios()时,如果你想在默认场景外使用新场景,可以编写类似如下代码: 上面
阅读全文
摘要:config.php 添加子模块后,在父模块添加管理入口配置,实现父模块管理子模块功能,如果父模块出现bug,子模块将无法继续使用
阅读全文
摘要:cat.php Dog.php Mouse.php controllers/AnimalController.php 调用第三方类库
阅读全文
摘要:程序 = 算法 + 数据结构 数据结构 制约了 算法的 >>>>依赖注入 依赖注入也就是解数据结构和算法耦合的思想
阅读全文
摘要:<?php /** * Created by PhpStorm. * Date: 2016/5/25 * Time: 19:09 * * YII的类的映射表 */ namespace frontend\controllers; use Yii; use yii\web\Controller; //use frontend\models\Post; //作用被下面的classMap...
阅读全文
摘要:http禁止缓存原理 HttpcacheController.php 首先判断的是客户端lastModified,如果最后更新时间没有变化,就不会更新缓存,然后再判断etagSeed httpcache/index.php
阅读全文
摘要:IndexController.php views/index/index.php
阅读全文
摘要:127.0.0.1 www.localhost.com 127.0.0.1 www.frontend.com 127.0.0.1 www.backend.com ServerAdmin frontend.com DocumentRoot "D:\wamp\www\advanced\frontend\web" ServerName www.fronte...
阅读全文
摘要:conn = mysql_connect('localhost','root',''); } //创建一个用来实例化对象的方法 public static function getInstance(){ if(!(self::$conn instanceof self)){ self::...
阅读全文
摘要://文件依赖 $dependency = new \yii\caching\FileDependency(['filename'=>'hw.txt'])}; $cache->add("file_key",'hello world',3000,$dependency);//$dependency决定了当缓存文件发生修改时也会失效 //表达式的依赖 $dependency = new...
阅读全文
摘要:版本1 require('class\class1.php'); require('class\class1.php'); if($is_girl){ echo 'this is a girl'; $class1 = new Class1; }else{ echo "this is a boy"; $class2 = new Class2; } 版本2 if...
阅读全文
摘要:以customer order两个表为例 //关联查询控制器中 $customer = Customer::find()->where('name'=>'zhangsan')->one(); $orders = $customer->hasmany('orders',['customer_id']=>'id')->asArray()->all(); $orders = $customer->...
阅读全文
摘要:grant 作用在存储过程、函数上: grant execute on procedure testdb.pr_add to 'dba'@'localhost' grant execute on function testdb.fn_add to 'dba'@'localhost' 查看当前用户(自
阅读全文
摘要:ab使用范例: 要执行 1000 次的 connection, 20 次的 concurrent (并行, 同时): ab 参数: Options are:
阅读全文
摘要:上一篇写了linux下定时任务,这一篇转发一个windows下定时备份数据库。 第一种:新建批处理文件 backup.dat,里面输入以下 注意:批处理命令中路径里有空格的话,必须在路径上加上双引号! 关于时间参数的参考: %date:~0,10% //提取年月日信息 %date:~-3% //提取
阅读全文
摘要:最近由于工作原因接触的linux的定时拉取远程数据库任务,故在此写下一些尚未测试的写法。 为当前用户创建cron服务 1. 键入 crontab -e 编辑crontab服务文件 例如 文件内容如下: */2 * * * * /bin/sh /home/admin/jiaoben/buy/delet
阅读全文
摘要:controller\hello renderPartial("index"); } } ?> view\hello\about.php hello about! view\hello\index.php hello index! render("about",array("v_hello_str"=>"hello...
阅读全文
摘要:controller\helloController.php<?php namespace app\controllers; use yii\web\Controller; class helloController extends Controller { public $layout = "co
阅读全文
摘要:YII基础准备1.命名空间<?php /****假设有三个同名的类,输出的值为A,B,C****/ use a\b\c\apple; use d\e\f\apple as bApple; use g\h\i\apple; $app = new apple();//A $app = new bAppl
阅读全文
摘要:YII 安装(2.0 advanced) 以下借鉴别人的博文 http://www.jb51.net/article/54055.htm 今天终于搞明白怎么安装Yii2了。对于我这种小白来说真是费尽周折。下面来介绍下如何安装Composer和如何使用Composer安装Yii2。 Composer是
阅读全文