摘要: 示例控制器: 阅读全文
posted @ 2016-04-14 11:12 yikai.shao 阅读(6304) 评论(0) 推荐(0) 编辑
摘要: 参考资料:http://www.bsourcecode.com/yiiframework2/how-to-create-custom-widget-in-yii2-0-framework/如何使用yii2框架自定义widget本教程教你如何自定义widget,widget是view中能被重用的代码块... 阅读全文
posted @ 2015-12-26 16:41 yikai.shao 阅读(2252) 评论(0) 推荐(0) 编辑
摘要: 使用方法// scenario is set as a property$model = new User;$model->scenario = User::SCENARIO_SHOW;// scenario is set through configuration$model = new User... 阅读全文
posted @ 2015-12-02 10:25 yikai.shao 阅读(622) 评论(0) 推荐(0) 编辑
摘要: 方式一:diff($datetime2)->format('%R%a'));}echo days(2015,1)."";echo days(2015,2)."";echo days(2015,3)."";echo days(2015,4)."";echo days(2015,5)."";echo d... 阅读全文
posted @ 2015-12-01 16:52 yikai.shao 阅读(964) 评论(0) 推荐(0) 编辑
摘要: 拉取wordpress镜像docker pull wordpress:latest创建mysql 容器docker run --name wordpress-mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:latest创建wordpress容器并link上一步创... 阅读全文
posted @ 2015-09-06 15:31 yikai.shao 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Role Based Access Control (RBAC)——基于角色的权限控制permissione.g. creating posts, updating postsroleA role represents a collection of permissions (e.g. creati... 阅读全文
posted @ 2015-08-26 09:49 yikai.shao 阅读(830) 评论(0) 推荐(0) 编辑
摘要: 修改my.ini去掉bind-address 127.0.0.1或添加bind-address 0.0.0.0mysql -u root -p 进入mysql,执行grant all privileges on *.* to root@"%" identified by '123456';然后flu... 阅读全文
posted @ 2015-06-09 15:06 yikai.shao 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 参考:http://www.cnblogs.com/phinecos/archive/2009/06/06/1497717.html一. samba的安装:sudoapt-getinsallsamba二.创建共享目录:mkdir/home/sharesoduchmod777/home/share三.... 阅读全文
posted @ 2015-06-08 17:22 yikai.shao 阅读(204) 评论(0) 推荐(0) 编辑
摘要: <?phpecho make_random_str();function make_random_str(){ $arr = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q&q 阅读全文
posted @ 2015-06-04 20:03 yikai.shao 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 直接上代码:$db = Yii::$app->db;$transaction = $db->beginTransaction(); //开启事务try { // 更新member表 $db->createCommand()->update('member',[ 'level' ... 阅读全文
posted @ 2015-05-29 14:21 yikai.shao 阅读(467) 评论(0) 推荐(0) 编辑
摘要: 作为PHP工程师,经常需要输出一下变量,以便检验程序是否正确,如:var_dump($var);exit;可是,每次这么写也太麻烦了,我们可以在程序的入口文件index.php中编写一个函数function ddd($param,$mark=false){ if($mark){ ... 阅读全文
posted @ 2015-05-29 14:10 yikai.shao 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 匹配IP地址第一种(((25[0-5])|([1-9]?[\d])|(1\d{2})|(2[0-4]\d))\.){3}((25[0-5])|([1-9]?[\d])|(1\d{2})|(2[0-4]\d))第二种((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d... 阅读全文
posted @ 2015-05-14 18:01 yikai.shao 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 文件hello.php和index.php在同一目录hello.php [2] => class hello{ [3] => [4] => public function __construct() [5] => { [6] => ... 阅读全文
posted @ 2015-05-11 11:44 yikai.shao 阅读(698) 评论(0) 推荐(0) 编辑
摘要: 举个例子就可以看懂了: 同一目录中有2个文件index.php和test.php,在test.php中定义一个test类。 test.php index.php 尽管 __autoload() 函数也能自动加载类和接口,但更建议使用 spl_autoload_register() 函数。 spl_a 阅读全文
posted @ 2015-05-11 09:20 yikai.shao 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 今天遇到一个很诡异的问题:数据库中存的日期信息为时间戳,用php取出数据库中的日期信息,并用date()函数转化为“Y-m-d”后,发现和mysql格式化函数Date_Format()处理后的结果不一致,总是少一天。这个问题导致程序中隐藏的bug,费了我好大劲,最后一步步调试,才最终发现是日期不一致... 阅读全文
posted @ 2015-04-29 17:28 yikai.shao 阅读(193) 评论(0) 推荐(0) 编辑