• Yii里面的一些细节tips


    1.当 $form = new LoginForm;

    $this->render('login', array('model' => $form));情况下

    如果视图login:

      <tr>
     <td width="80" align="right"><?php echo $form->label($model, 'email'); ?>:</td>
     <td><?php echo $form->textField($model, 'email', array('class' => 'input_s', 'style' => '240px')); ?></td>
      </tr>
    

      说明:已经给name,id赋值了。

    <input class="input_s" style="240px" name="LoginForm[email]" id="LoginForm_email" type="text">
    

    2.实现Yii的伪静态

    在web应用根目录下建立..htaccess文件,代码如下:
    
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^你的域名.com[NC]
    RewriteRule ^(.*)$ http://www.你的域名.com/$1 [L,R=301]
    
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1
    
     
    
    这样就可以实现Yii的伪静态了,可以将如下路径:
    
    http://localhost/webname/index.php?r=item/list
    
    修改为如下友好且容易被搜索引擎收录的地址:
    
    http://localhost/webname/item/list.html 
    

      

  • 相关阅读:
    sysctl.conf文件详解
    linux下高并发网络应用注意事项
    linux 异常
    myeclipse 上安装 Maven3
    windows 系统相关配置
    常用DOS命令总结
    豆瓣爬虫Scrapy“抄袭”改写
    vue基本配置和生命周期
    面试知识点
    ubuntu18.04国内软件源
  • 原文地址:https://www.cnblogs.com/fengzhiqiangcaisangzi/p/3370037.html
Copyright © 2020-2023  润新知