-
<?php
namespace
?app\controllers;
use
?yii\web\Controller;
?class
?HelloController?
extends
?Controller{
????
public
?function
?actionIndex(){
????????
$request
?=?\YII::
$app
->request;
?????????
//echo?$request->get("id",20);??//?獲取get參數(shù)
????????
//$request->post('name',?23333);?//?獲取post參數(shù)
?????????
if
(
$request
->isGet){?
//?判斷是否為get方法
????????????
echo
?"this?is?get?method"
;
????????
}??
????????
if
(
$request
->isPost){?
//?判斷是否為post方法
????????????
echo
?"this?is?post?method"
;
????????
}??
????????
?????????
//echo?$request->userIp;??? //?獲取服務(wù)器IP地址
????????
//echo?"hello?world";
????
}
}
?>
查看全部 -
<?php
namespace app\Controllers
use yii\web\controller
class HelloController extends Controller{
function actionIndex(){
echo "hello world"?
}
}
查看全部 -
$customer=$order->customer;注意customer的C小寫
查看全部 -
一個(gè)訂單屬于一個(gè)顧客,所以用hasOne函數(shù)
查看全部 -
自動(dòng)補(bǔ)充調(diào)用函數(shù)getOrders()
查看全部 -
one()函數(shù)以對(duì)象方式返回查詢內(nèi)容
查看全部 -
增加數(shù)據(jù)時(shí)進(jìn)行驗(yàn)證
查看全部 -
查詢語句
查看全部 -
? ? $results=Test::find()->where(['id'=>1])->all();
? ? print_R($results);
查看全部 -
避免sql注入的方法
查看全部 -
最簡(jiǎn)單的數(shù)據(jù)模型
查看全部 -
創(chuàng)建數(shù)據(jù)模型在yii框架basic->models中
查看全部 -
basic->config->db.php是數(shù)據(jù)庫配置文件
查看全部 -
php視圖文件顯示的if語句
查看全部 -
index視圖中再顯示about視圖及其數(shù)組變量
查看全部
舉報(bào)