zoukankan      html  css  js  c++  java
  • yii总结

    自己的Yii使用的总结,就当是做笔记,防止忘记

     YII model相关

       - Mode的提示,在 @property integer $id 里设置。

       - 每个字段的提示,在rules里设置

       - 表与表之间的关系,在relation里设置,具体各种关系,有待后续学习总结

      

    mysql无法插入中文问题

     'db'=>array(
                'connectionString' => 'mysql:host=127.0.0.1;dbname=test',
                'emulatePrepare' => true,
                'username' => 'root',
                 'password' => '123',

                'charset' => 'gbk',  //数据库配置问题,如果是utf8就无法插入

    YII linux 出现如下错误

    CDbConnection failed to open the DB connection: could not find driver 

    请配置php的mysql pdo 

    CListView显示Page的页码在Url中采用如下方式 

    <?php $this->widget('zii.widgets.CListView', array(
    'dataProvider'=>$dataProvider,
    'itemView'=>'_view',
        'enablePagination' => true,
         'ajaxUpdate'=>false,
    )); ?>


    获取当前host

     Yii::app()->request->getServerName();
    //and
    $_SERVER['HTTP_HOST'];
     
     

    $url = 'http://'.Yii::app()->request->getServerName(); $url .= CController::createUrl('user/activateEmail', array('emailActivationKey'=>$activationKey));   

    echo$url

  • 相关阅读:
    Winform架构
    SQL2008多数据库查询表或删表
    hdu1114 PiggyBank
    hdu2844 Coins
    hdu2602 Bone Collector
    hdu2191 珍惜现在
    hdu1203 I NEED A OFFER!
    求推荐
    TransparentBlt
    双缓冲加载位图 WinCE
  • 原文地址:https://www.cnblogs.com/likwo/p/2154672.html
Copyright © 2011-2022 走看看