第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

老師分我改了下

<?php
?class functionsController{
??function add(){
???if (empty($_POST)){
????if (isset($_GET['id'])){
?????$functionsObj = M('functions');
?????$data = $functionsObj->findOne_by_id($_GET['id']);
????}else{
?????$data = array();
????}
????VIEW::assign(array('data'=>$data));
????VIEW::display('system/functions.html');
???}else{
????$functionsObj = M('functions');
????//$result = $functionsObj->add($_POST);
????//$this->swich_result($result);
????if(empty($_POST['title'])||empty($_POST['controller'])||empty($_POST['method'])){
?????return 0;
????}else{
?????if ($_POST['id']==""){
??????$functionsObj->add($_POST);
??????$this->swich_result(1);
?????}else{
??????$functionsObj->update($_POST);
??????$this->swich_result(2);
?????}
????}
???}
??}
??function show(){
???$functionObj = M('functions');
???$data = $functionObj->findAll();
???VIEW::assign(array('data'=>$data));
???VIEW::display('system/functionsList.html');
??}
??
??private function swich_result($result){
???if($result == 0){
????$this->showmessage('操作失?。?,'http://localhost/index.php?controller=functions&method=add&id='.$_POST['id']);
???}
???if($result == 1){
????$this->showmessage('添加成功!','http://localhost/index.php?controller=functions&method=show');
???}
???if($result == 2){
????$this->showmessage('修改成功!','http://localhost/index.php?controller=functions&method=show');
???}
??}
??
??private function showmessage($info, $url){
???echo "<script>alert('$info');window.location.href='$url'</script>";
???exit;
??}
?}


<?php
class functionsModel {
?
?public $_table = 'functions';
?
?function add($data){
??extract($data);
?
??$title = addcslashes($title);
??$controller = addslashes($controller);
??$method = addslashes($method);
? $parent_id = addslashes($parent_id);
??$data = array('title'=>$title,'controller'=>$controller,'method'=>$method,'parent_id'=>$parent_id);
??DB::insert($this->_table,$data);
?}
?
?function delete_by_id($id){
??$id = intval($id);
?}
?
?function update_by_id($data){
??extract($data);
??$data = array('title'=>$title,'controller'=>$controller,'method'=>$method,'parent_id'=>$parent_id);
??DB::update($this->_table,$data,'id='.$id);
?}
?
?function findOne_by_id($id){
??$id = intval($id);
??$sql = 'select * from funcitons where id ='.$id;
??return DB::findOne($sql);
?}
?function findAll(){
??$sql = 'select * from functions';
??return DB::findAll($sql);
?}
}
?>

正在回答

2 回答

改的不錯(cuò)

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

老師分我改了下

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)