Why does my TP framework accept post data without clicking submit?

Source: Internet
Author: User

Some of the guys said it was ispost wrong, and now we're going to send a look at what's on the manual.

Red Label 3 is a simple few lines of code, the red one is the method of the corresponding link

The problem is, my code is clearly written in the case of if (is_post), only echo that 11111, why the display page is displayed directly, Ah, should not be after I click the Submit button to appear?

Submit Address Yes

PHP section:

Class Bcastaction extends commonaction{

public function index(){
    $this->display();}

Public Function Insert () {

$this->display();

}

public function add(){

$IS _post=$_server[' request_method '] = = ' POST '? True:false;

    if($IS_POST){

Echo ' 111 ';d ie;
}

}

}
?>

That's all, I don't know what's wrong.

Should be
if (is_post)
{

echo 111;

}

Your tp version of 2.0 is not supported, IS_POST IS_GET This type of notation, tp the constant IS_POST , IS_GET and so on in the 3.1 version only. Since the wording does not support, you directly use the most primitive $_post, $_get can not? Finish the task first.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.