原创 yii 驗證碼 CCaptcha的總結

今天用到yii的驗證碼 ccaptcha,經過在網上搜尋 找到以下例子: 1、在controller中加入代碼 (1)啓用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <?php public

原创 Yii中validator之scenario

http://www.cnblogs.com/springdong/archive/2013/05/05/3060457.html  Yii中有個場景的概念,我們用到場景的地方主要是在model中定義rules規則的時候,可以對不同的場

原创 yii ajax csrf token not verfied 解決

在yii 開啓csrf之後,每一個post請求yii 都會驗證csrf, 針對使用沒有form的ajax post請求,在ajax中不能添加datatype:"json" contentType: "application/json;ut

原创 yii CActiveDataProvider condition like 的用法

        $dataProvider =new CActiveDataProvider('Item',         array('criteria' => array('select'    => "*",         

原创 js 替換換行

內容.replace('\r\n',''); 這個只能替換 \r\n兩個在一起的,\n內容\r這個是不能換的 內容.replace('\r')執行一次替換一個\r,replace('\n')也是 另外 r

原创 ECSHOP用戶名已經存在的解決方法

ECSHOP用戶名已經存在的解決方法 筆者碰到的情況基本是由於 輸出的result 裏面有\r \n 造成的,所以有兩種辦法解決這個問題: 1. 需要修改JS文件夾下的user.js,在function registed_callba

原创 htmlspecialchars

PHP:htmlspecialchars可以過濾客戶在瀏覽器post的數據,防止xss。 javascript: string.replace(/\&/g,encodeURIComponent("&")); 可以用此方法對 &符合過濾。

原创 yii findall 使用方法

$post = $POST::model()->findAll(); //列出所有post model中的數據, 讀取 foreach( $post as $record) { print( $record->filedName) ; /