<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                1. 將更改根目錄下在Shop/Controller文件夾下的AdminController.class.php為 ~~~ <?php namespace Shop\Controller; use Think\Controller; use Com\Wechat; use Com\WechatAuth; class AdminController extends Controller { public function add(){ $this->display(); } public function addgoods(){ header("Content-type:text/html;charset=utf-8"); $m=M('goods'); $upload = new \Think\Upload();// 實例化上傳類 $upload->maxSize =3145728 ;// 設置附件上傳大小 $upload->exts =array('jpg', 'gif', 'png', 'jpeg');// 設置附件上傳類型 $upload->rootPath ='./Public/Uploads/'; // 設置附件上傳目錄 // 上傳文件 $info = $upload->upload(); if(!$info) {// 上傳錯誤提示錯誤信息 echo '<script type="text/javascript">alert("上傳圖片失敗");</script>'; exit; }else{// 上傳成功 $_POST['img']=$info['img']['savepath'].$info['img']['savename']; $arr=$m->add($_POST); if($arr){ echo '<script type="text/javascript">alert("添加成功");history.go(-1);</script>'; }else{ echo '<script type="text/javascript">alert("添加失敗");history.go(-1);</script>'; } } } //商品列表頁 public function lists(){ $m=M('goods'); $data=$m->select(); $this->assign("data",$data); $this->display(); } //刪除商品 public function del(){ header("Content-type:text/html;charset=utf-8"); $id=$_GET['id']; $m=M('goods'); $res=$m->delete($id); if($res){ echo '<script>alert("刪除成功");history.go(-1);</script>'; }else{ echo '<script>alert("刪除失敗");history.go(-1);</script>'; } } } ~~~ 2. 將更改根目錄下在Shop/View文件夾下的lists.html為 ~~~ <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 上述3個meta標簽*必須*放在最前面,任何其他內容都*必須*跟隨其后! --> <title>益達微信商城開發課</title> <!-- Bootstrap --> <link href="__PUBLIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="__PUBLIC__/bootstrap/js/html5shiv.min.js"></script> <script src="__PUBLIC__/bootstrap/js/respond.min.js"></script> <![endif]--> </head> <body> <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="{:U('Admin/add')}"> <<商品添加 </a> </div> </div> </nav> <table class="table table-striped"> <tr> <th>序號</th> <th>商品名</th> <th>規格</th> <th>價格</th> <th>操作</th> </tr> <input type="hidden" value="{$i=0}" /> <foreach name="data" item="vo" > <tr> <td>{$i}</td> <td>{$vo.name}</td> <td>{$vo.pex}</td> <td>{$vo.pirce}</td> <td><a href="{:U('Admin/del',array('id'=>$vo['id']))}">刪除</a></td> </tr> <input type="hidden" value="{$i++}"> </foreach> </table> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="__PUBLIC__/bootstrap/js/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="__PUBLIC__/bootstrap/js/bootstrap.min.js"></script> </body> </html> ~~~ 3. 在瀏覽器輸入:域名//index.php/shop/admin/lists,并且商品添加與刪除功能能實現 ![](https://box.kancloud.cn/b00e3bbb067ae86bce19465996795469_1440x323.png) 4. 本節相關源碼下載(下載密碼:idbk)點擊[下載](https://pan.baidu.com/s/1HMx4GHjgR9nFYF5kgVQNRA)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看