摘要:本文将带你了解WEBAPP开发教程YII学习笔记,希望本文对大家学WEBAPP有所帮助。
本文将带你了解WEBAPP开发教程YII学习笔记,希望本文对大家学WEBAPP有所帮助。
1. % YiiRoot/framework/yiic webapp WebRoot/testdrive
2.默认Yii框架的URL规则是//hostname/index.php?r=controllerName/actionName&id=1
3.$this->render('index',array('a'=>"123"));
4.
$hostname=Yii::app()->request->userHost;
$status=$_REQUEST['status'];
5.
'request'=>array(
'class'=>'CHttpRequest',
),
$host=Yii::app()->request->hostInfo;
$this->render('index',array('a'=>"123",'b'=>$host));
6.
$name=$_POST["name"];
$pass=$_POST["pass"];
$this->render('result',array('a'=>$name,'b'=>$pass));
7.改变显示模板 $this->layout = 'admin';
8.php yiic shell config/main.php
9.model Aadmins
crud Department
10. $model=Aadmins::model()->find();
print_r($model);
11.<formaction="/yemmys/yemmys/index.php?r=site/login"method="post">
12.<input name="LoginForm[username]"id="LoginForm_username" type="text" value=""/>
13.$this->redirect('index.php?r=admin/manage');
14.Yii::app()->user->name
15.public function actionLogout()
{
Yii::app()->user->logout();
$this->redirect(Yii::app()->homeUrl);
}
16.<?php echoYii::app()->request->baseUrl;?>/css/screen.css
17.dirname(Yii::app()->BasePath)
18.Yii::getPathOfAlias('webroot')
19.
array('modified','default',
'value'=>new CDbexpression_r('NOW()'),
'setOnEmpty'=>false,'on'=>'update'),
array('created,modified','default',
'value'=>new CDbexpression_r('NOW()'),
'setOnEmpty'=>false,'on'=>'insert')
20. ckeditor:
21.'viewButtonUrl'=>'Yii::app()->createUrl("/yemmysnews/view",array("id" => $data->newsid))',
22.在model里加:
publicfunction beforeSave()
{
$pass = md5($this->password);
$this->password = $pass;
return true;
}
23.Yii::app()返回的是我们在入口程序中建立的应用对象。
根据这个配置。我们可以在程序的任何地方通过使用 Yii::app()->db来获取连接到数据库的对象。
Yii::log('eeeee1231123','info');
$connection=Yii::app()->db;
$connection->active=true;
$command=$connection->createCommand("select`managername`,`password` from cdb_yemmysmanagers");
$command->execute(); // a non-query SQL statement execution
// or execute an SQL query and fetch the resultset
$reader=$command->query();
// each $row is an array representing a row ofdata
foreach($reader as $row)
{
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标移动开发之WebApp频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号