Yii框架操作数据库的几种方式与mysql_escape_string
摘要:一、Yii操作数据库的几种选择1,PDO方式。$sql = "";//原生态sql语句xx::model()->dbConnection->createCommand($sql)->execute();2,Active Record方式(1)New$post=new Post;$post->title='sample post';$post->content='post body content';$post->save();(2)Criteria方式也可以使用 $condition 指定更复杂的查询条件。
阅读全文
posted @
2014-02-24 17:17
FreeSpider
阅读(3572)
推荐(0) 编辑
php获取某年某月的天数
摘要:function days_in_month($month, $year) { // calculate number of days in a month return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31); }
阅读全文
posted @
2014-02-12 14:24
FreeSpider
阅读(2955)
推荐(0) 编辑