上一页 1 ··· 6 7 8 9 10 11 下一页
摘要: 1 $v1) 6 { 7 $arr2=explode(',',$v1); 8 var_dump($arr2); 9 $arr3=explode(':',$arr2[0]);10 echo '开始日期:',$arr3[0],'结束日期:',$arr3[1],'';11 if($arr2[2] == 0)12 {13 echo '开始时间戳:',$start=strtotime($arr3[0]),'——';14 echo '结束时间戳:',$end=strtotime( 阅读全文
posted @ 2013-05-28 16:00 jami918 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 1. 创建配置文件protected/config/main.php 1 <?php 2 3 // This is the main Web application configuration. Any writable 4 // CWebApplication properties can be configured here. 5 return array( 6 7 // preloading 'log' component 8 'preload'=>array('log'), 9 10 // application compon 阅读全文
posted @ 2013-05-21 20:55 jami918 阅读(497) 评论(0) 推荐(0) 编辑
摘要: Yii的Model ( 模型)创建及使用YII 实现了两种模型,表单模型(CFormModel类)和ActiveRecord模型(CAtiveRecord类),它们都继承自CModel类。 CFormModel代表的数据模型是从HTML表单收集的输入,封装了所有逻辑(如表单的验证和其它业务逻辑,应用到表单的域上)。它能将数据存储在内 存中,或者在一个ActiveRecord的帮助下,存入数据库里。一.基于CActiveRecord的ModelActiveRecord(AR)是一种设计模式,用面向对象的方式抽象的访问数据,Yii中,每一个AR对象的实例都可以是CActiveRecord类或者它的 阅读全文
posted @ 2013-05-15 16:14 jami918 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 控制器:$infos = $this->db->listinfo(array('siteid'=>$this->get_siteid(),'themeid'=>$themeid),'subjectid ASC',$page, '14'); $newarr = array(); foreach ($infos as $value) { $t1=$value['subject']; $subjectid = intval($value[subjectid]); $newarr[$subje 阅读全文
posted @ 2013-05-14 17:24 jami918 阅读(481) 评论(0) 推荐(0) 编辑
摘要: 注册会使用验证码,下面是验证码的使用方法:Yii中如何使用验证码:在Model层的文件中插入 public $verifyCode; 在rules()中插入 array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()), 在attributeLabels()中插入 'verifyCode' =>'验证码';在Controller层的文件中插入 public function actions() { return 阅读全文
posted @ 2013-05-03 23:33 jami918 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 框架无非就是mvc,只是调用的父类操作比较繁琐。登录:C:TestController.php/actionLogin方法 public function actionLogin() { $model=new TestLogin; if(isset($_POST['ajax']) && $_POST['ajax']==='login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } if(isset($_POST['TestLogin& 阅读全文
posted @ 2013-05-03 22:27 jami918 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 匹配ip地址:((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}2[0-4]\d|25[0-5]|[01]?\d\d?后向引用:(\w+)\s?\\1注意:数字1前面有两个\零宽断言:1:(?exp) 如:\w+(?=ing)查找字符串i'm singing 匹配sing2:(?<=exp) 如:(?<=re)\w+查找字符串i'm reading 匹配ading3:综合运用如:/(?<=<((\w)+)>).*(?=<\/\\1>)/ 匹配html标签如<b>.*</b>负向零宽断言:1: 阅读全文
posted @ 2013-05-03 17:20 jami918 阅读(132) 评论(0) 推荐(0) 编辑
摘要: main.php 'db1'=>array( 'class'=>'CDbConnection', 'connectionString' => 'mysql:host=localhost;dbname=test1', 'emulatePrepare' => true, 'username' => 'root', 'password' => '', 'charset' => ' 阅读全文
posted @ 2013-04-28 16:39 jami918 阅读(430) 评论(0) 推荐(0) 编辑
摘要: 写一个函数,算出两个文件的相对路径如 $a = ‘/a/b/c/d/e.php’;$b = ‘/a/b/12/34/c.php’;计算出 $b 相对于 $a 的相对路径应该是 http://www.cnblogs.com/c/d解: 1 $a = '/a/b/c/d/e/g/f.php'; 2 $b = '/a/b/12/34/c.php'; 3 4 $arr_a=explode('/',$a);$arr_b=explode('/',$b); 5 $count_a=count($arr_a);$count_b=count($arr 阅读全文
posted @ 2013-03-24 22:52 jami918 阅读(164) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2013-03-24 21:30 jami918 阅读(3) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 下一页