aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABAEAAANXCAIAAADLkdErAAAgAElEQVR4nOzdfWwc953nef6zwO5Zg8…
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAv4AAANcCAIAAACopDy/AAAgAElEQVR4nOzdfXAb52H4ef1veSatRV…
1.创建model   /biaodan.php <?php /** * Created by PhpStorm. * User: moka同学 * Date: 2016/08/05 * Time: 10:26 */ namespace app\models; use Yii; use yii\base\Model; class Biaodan extends Model{ public $name; public $pass; public $email; public $sex; publi…
  一. [:id占位符]使用 $results = Test::findBySql($sql,array(':id'=>'1 or 1=1))->all()   二. [id=1]  选出id为1的数据 $results = Test::find()->where(['id'=>1])-all(); 三.  [id>0]  选出id>0的数据 $results = Test::find()->where(['>','id',0])->all() 四.…
第一次使用,时候不明白什么原理,大概用了几次后,才模模糊糊搞清楚原来是怎么一回事,现在就把写过的代码,贴在下边. 1.在视图文件中, 第一步首先在index.php文件中 做了一个a链接的按钮 调用了modal <a class="btn btn-default pull-right" data-remote="<?= Url::toRoute(['create', '_wicket' => 'yes']) ?>" data-toggle=&…
Yii2中对于表单和字段的支持组件为ActiveForm和ActiveField, <?php $form = ActiveForm::begin([ 'id' => 'login-form', 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => [ 'template' => "{label}\n<div class=\"col-lg-3\">{input…
前半部分为自己使用的过程,下边为转载的,具体地址见:http://blog.sina.com.cn/s/blog_88a65c1b0101j717.html 1.在model中 public function rules() { return [ [['join_verify', 'create_activity', 'is_open_group', 'is_open_child_com','sendmail_limit','sendmail_from_name','sendmail_from'…
1.Model中Code.php <?php /** * Created by PhpStorm. * User: moka同学 * Date: 2016/07/25 * Time: 10:48 */ namespace app\models; use yii\base\Model; class Code extends Model{ public $verifyCode; public function rules() { return [ ['verifyCode','captcha','c…
1.在widgets/TestWidget.php中 <?php /** * Created by PhpStorm. * User: moka同学 * Date: 2016/08/05 * Time: 18:15 */ namespace app\widgets; use yii\base\Widget; class TestWidget extends Widget { public $msg = ''; //初始化 public function init() { parent::init…
这是第一种方法,还有另一种方法,其实都差不多. 1.在创建widgets\HelloWiget.php <?php /** * Created by PhpStorm. * User: Administrator * Date: 2016/08/05 * Time: 15:55 */ namespace app\widgets; use yii\base\Widget; class HelloWidget extends Widget { public $msg = ''; //初始化 publ…