国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

??
回復(fù)內(nèi)容:
? ??? ?? PHP ???? 使用ajax,xhr卻沒有響應(yīng)

使用ajax,xhr卻沒有響應(yīng)

Jul 06, 2016 pm 01:51 PM
php thinkphp

1.項(xiàng)目中用到了ajax。結(jié)果測(cè)試時(shí)候發(fā)現(xiàn)頁面在兩款瀏覽器中表現(xiàn)不一:360瀏覽器可以順利實(shí)現(xiàn)彈窗(alert)效果,火狐瀏覽器卻一點(diǎn)效果全無。但是他們都有一個(gè)共同特點(diǎn):在瀏覽器的調(diào)試模式(F12)的網(wǎng)絡(luò)選項(xiàng)xhr下沒有得出任何的數(shù)據(jù),而在網(wǎng)絡(luò)的全部、html、css、js這些地方都可以看到有數(shù)據(jù),包括index首頁(POST),其他資源都是以GET獲得。
2.使用了ThinkPHP的自動(dòng)驗(yàn)證功能,錯(cuò)誤會(huì)自動(dòng)返回信息,包括沒有輸入用戶名或沒有輸入密碼,但是我沒對(duì)賬號(hào)密碼進(jìn)行比對(duì),也不知道為什么在360瀏覽器中用戶名和密碼我隨便亂輸了數(shù)據(jù),結(jié)果發(fā)現(xiàn)一個(gè)空白alert對(duì)話框出來,也不知道這是什么回事?
3.360瀏覽器中alert對(duì)話框出現(xiàn)的時(shí)候,xhr還是有數(shù)據(jù)的,但是當(dāng)alert對(duì)話框點(diǎn)擊確定后,xhr數(shù)據(jù)就隨之消失。
使用ajax,xhr卻沒有響應(yīng)
使用ajax,xhr卻沒有響應(yīng)

代碼如下:
(1)login.js

<code>//前端登錄業(yè)務(wù)類
var login={
  checkUser:function(){
    //獲取登錄頁面中的輸入數(shù)據(jù)
    var userName=$('input[name="username"]').val();
    var userPass=$('input[name="userpass"]').val();
    //使用ajax
    var url="/stfjzd-15/index.php/Home/Index/checkUser";
    var data={"username":userName,"userpass":userPass};
    $.post(url,data,function(result){
      //$("#result").html(data.info).show();
      //$("#result").fadeOut(4000);
      if(result.status){
        alert(result.info);
      }else{
        //alert(2);
        alert(result.info);
      }
    },"json");
  }
}</code>

(2)IndexController.class.php

<code><?php namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
  public function index(){
    $this->display();
  }
  //用戶驗(yàn)證
  public function checkUser(){
    //接收變量,默認(rèn)htmlspecialchars過濾
    $userName=I("post.username");
    $userPass=I("post.userpass");
    $User=D("Stuser");
    //ThinkPHP的自動(dòng)驗(yàn)證必須使用create()才能啟用
    if(!$User->create()){
      return $this->error($User->getError());
      //exit($User->getError());
    }
  }
  //空操作
  public function _empty(){
    echo "頁面不存在,請(qǐng)檢查您輸入的路徑是否正確,我要返回<a href="%22._PHP_FILE_.%22" alt="返回首頁" title="返回首頁">首頁</a>";
  }
}</code>

(3)StuserModel.class.php

<code><?php namespace Home\Model;
  use Think\Model;
  //用戶表模型
  class StuserModel extends Model{
    //構(gòu)造函數(shù)創(chuàng)建模型
    public function __construct(){
      $this->DB=M("Stuser");
    }
    //ThinkPHP的表單自動(dòng)驗(yàn)證
    protected $_validate=array(
      array("username","require","用戶名不能為空"),
      array("userpass","require","密碼不能為空"),
    );

  }
?></code>

回復(fù)內(nèi)容:

1.項(xiàng)目中用到了ajax。結(jié)果測(cè)試時(shí)候發(fā)現(xiàn)頁面在兩款瀏覽器中表現(xiàn)不一:360瀏覽器可以順利實(shí)現(xiàn)彈窗(alert)效果,火狐瀏覽器卻一點(diǎn)效果全無。但是他們都有一個(gè)共同特點(diǎn):在瀏覽器的調(diào)試模式(F12)的網(wǎng)絡(luò)選項(xiàng)xhr下沒有得出任何的數(shù)據(jù),而在網(wǎng)絡(luò)的全部、html、css、js這些地方都可以看到有數(shù)據(jù),包括index首頁(POST),其他資源都是以GET獲得。
2.使用了ThinkPHP的自動(dòng)驗(yàn)證功能,錯(cuò)誤會(huì)自動(dòng)返回信息,包括沒有輸入用戶名或沒有輸入密碼,但是我沒對(duì)賬號(hào)密碼進(jìn)行比對(duì),也不知道為什么在360瀏覽器中用戶名和密碼我隨便亂輸了數(shù)據(jù),結(jié)果發(fā)現(xiàn)一個(gè)空白alert對(duì)話框出來,也不知道這是什么回事?
3.360瀏覽器中alert對(duì)話框出現(xiàn)的時(shí)候,xhr還是有數(shù)據(jù)的,但是當(dāng)alert對(duì)話框點(diǎn)擊確定后,xhr數(shù)據(jù)就隨之消失。
使用ajax,xhr卻沒有響應(yīng)
使用ajax,xhr卻沒有響應(yīng)

代碼如下:
(1)login.js

<code>//前端登錄業(yè)務(wù)類
var login={
  checkUser:function(){
    //獲取登錄頁面中的輸入數(shù)據(jù)
    var userName=$('input[name="username"]').val();
    var userPass=$('input[name="userpass"]').val();
    //使用ajax
    var url="/stfjzd-15/index.php/Home/Index/checkUser";
    var data={"username":userName,"userpass":userPass};
    $.post(url,data,function(result){
      //$("#result").html(data.info).show();
      //$("#result").fadeOut(4000);
      if(result.status){
        alert(result.info);
      }else{
        //alert(2);
        alert(result.info);
      }
    },"json");
  }
}</code>

(2)IndexController.class.php

<code><?php namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
  public function index(){
    $this->display();
  }
  //用戶驗(yàn)證
  public function checkUser(){
    //接收變量,默認(rèn)htmlspecialchars過濾
    $userName=I("post.username");
    $userPass=I("post.userpass");
    $User=D("Stuser");
    //ThinkPHP的自動(dòng)驗(yàn)證必須使用create()才能啟用
    if(!$User->create()){
      return $this->error($User->getError());
      //exit($User->getError());
    }
  }
  //空操作
  public function _empty(){
    echo "頁面不存在,請(qǐng)檢查您輸入的路徑是否正確,我要返回<a href="%22._PHP_FILE_.%22" alt="返回首頁" title="返回首頁">首頁</a>";
  }
}</code>

(3)StuserModel.class.php

<code><?php namespace Home\Model;
  use Think\Model;
  //用戶表模型
  class StuserModel extends Model{
    //構(gòu)造函數(shù)創(chuàng)建模型
    public function __construct(){
      $this->DB=M("Stuser");
    }
    //ThinkPHP的表單自動(dòng)驗(yàn)證
    protected $_validate=array(
      array("username","require","用戶名不能為空"),
      array("userpass","require","密碼不能為空"),
    );

  }
?></code>

$this->ajaxReturn()或者json_encode試試

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

?? ????
1783
16
Cakephp ????
1727
56
??? ????
1577
28
PHP ????
1442
31
???
PHP?? ?? ?? ID? ?? ??? ?????? PHP?? ?? ?? ID? ?? ??? ?????? Jul 13, 2025 am 03:02 AM

PHP?? ?? ?? ID? ?? ??? Session_id () ??? ???? ???? Session_Start ()? ???? ????? ??????. 1. ??? ????? ?? _start ()? ?????. 2. Session_id ()? ???? ?? ID? ?? ABC123DEF456GHI789? ??? ???? ?????. 3. ??? ?? ??? Session_Start ()? ??????, ???? ???? ?????? ?? ??? ?????? ??? ??????. 4. ?? ID? ??, ?? ?? ? ?? ?? ??? ??? ? ??? ?????? ???????. ??? ???? ????? ID? ????? ?? ? ??? ??????.

PHP ????? ?? ???? ???? PHP ????? ?? ???? ???? Jul 13, 2025 am 02:59 AM

PHP ????? ?? ???? ????? Syntax substr (String $ String, int $ start,? int $ length = null) ? substr () ??? ??? ? ??? ??? ???? ??? ??? ?????. ???? ?? ?? ??? ??? ?? ? ?? MB_SUBSTR () ??? ???? ?? ??? ??????. ?? ???? ?? ???? ?? ????? ?? exploit () ?? strtr ()? ???? ?? ?? ??? ?? ??? ?? ??? ?? ??? ? ????.

PHP ??? ?? ?? ???? ??? ?????? PHP ??? ?? ?? ???? ??? ?????? Jul 13, 2025 am 02:54 AM

UnitTestingInphPinvolvesVeverifying individualCodeUnitsInitsIntsormeStodStocatchBugSearlyLylyLearLiAberFactoring.1) setupphPunitviacomposer, createEatestDirectory, and ConfigeAuteAutoloadandPhpunit.xml.2) writeTestCases-oct-oct-asserterfat

PHP?? ???? ??? ???? ?? PHP?? ???? ??? ???? ?? Jul 13, 2025 am 02:59 AM

PHP?? ?? ???? ??? exploit () ??? ???? ???? ??? ???? ????. ? ??? ??? ?? ??? ?? ???? ?? ???? ??? ??? ?????. ??? Exploit (???, ???, ??)??, ??? ???? ????? ???? ?? ?????, ??? ????? ?? ?? ?????? ??? ?? ?????. ?? ?? $ str = "Apple, Banana, Orange"; $ arr = Explode ( ",", $ str); ??? [ "Apple", "Bana???

JavaScript ??? ?? : ?? ? ?? JavaScript ??? ?? : ?? ? ?? Jul 13, 2025 am 02:43 AM

JavaScript ??? ??? ?? ?? ? ?? ???? ????. ?? ???? ???, ??, ??, ?, ???? ?? ? ??? ?????. ?? ????? ?? ?? ? ? ??? ????? ?? ??? ??? ????. ??, ?? ? ??? ?? ?? ??? ??? ??? ???? ??? ??? ???? ??? ?? ??? ????. ?? ? ????? ??? ???? ? ??? ? ??? TypeofNull? ??? ?????? ??? ? ????. ? ? ?? ??? ???? ?????? ????? ???? ??? ???? ? ??? ? ? ????.

std :: Chrono ?? c std :: Chrono ?? c Jul 15, 2025 am 01:30 AM

STD :: Chrono? ?? ?? ??, ?? ?? ??, ?? ?? ? ?? ?? ? ?? ?? ??? ???? C?? ???? ??? ?????. 1. std :: chrono :: system_clock :: now ()? ???? ?? ??? ?? ? ??? ?? ??? ???? ?? ? ? ??? ??? ??? ???? ?? ?? ? ????. 2. std :: Chrono :: steady_clock? ???? ?? ??? ???? ?? ??? ???? duration_cast? ?? ?? ?, ? ? ?? ??? ??????. 3. ?? (time_point) ? ?? (??)? ?? ??? ? ? ??? ?? ??? ? ?? epoch (epoch)???? ???????.

PHP? ?? ??? ?? ???? ???? ??? ?????? PHP? ?? ??? ?? ???? ???? ??? ?????? Jul 13, 2025 am 02:39 AM

PHP?? ?? ??? ?? ???? ????? ?? ??? ???? ???? ??? $ _session ? ??? ???? ????. 1. ? ???? ?? ??? ???? ?? Session_Start ()? ???? ???? ??? ???????. 2. $ _session [ 'username'] = 'johndoe'? ?? ?? ??? ?????. 3. ?? ????? session_start ()? ?? ? ? ??? ? ??? ?? ??? ???????. 4. Session_Start ()? ? ????? ???? ??? ????, ???? ?? ???? ??, ??? ?? ???? ??? ?? ? ? ??? ??????. 5. SES? ??????

PHP? ?? ??? ??? ?????? PHP? ?? ??? ??? ?????? Jul 14, 2025 am 03:01 AM

toaccessenvironmentvariablesinphp, usegetenv () ?? $ _envsuperglobal.1.getenv ( 'var_name') retrievespescificvariable.2. $ _ en v [ 'var_name'] accessesvariablesifvariables_orderinphp.iniincludes "e".setvariablesviacliwithvar = valuephpscript.php, inapach

See all articles