In the ThinkPHP5 method, can return be output directly? Please advise

Source: Internet
Author: User
Please kindly advise how the process is. if TP5 is straight in the method and return is used, relevant content will be output on the interface. how can this be achieved?, and ask for advice. Note: You may think the problem is very simple, but I really don't know, so please. I want to know the execution process and method behind it. Please kindly advise how the process is. if TP5 is straight in the method and return is used, relevant content will be output on the interface. how can this be achieved?, and ask for advice.

Note: You may think the problem is very simple, but I really don't know, so please. I want to know the execution process and method behind it.

Reply content:

Please kindly advise how the process is. if TP5 is straight in the method and return is used, relevant content will be output on the interface. how can this be achieved?, and ask for advice.

Note: You may think the problem is very simple, but I really don't know, so please. I want to know the execution process and method behind it.

Previously usedTP3.2, Changed5.xLater, I also found this and briefly looked at the source code.

The execution process is as follows:

  1. index.php

    require __DIR__ . '/../thinkphp/start.php';
  2. start.php

    App::run()->send();
  3. App.php

    $type     = $isAjax ? Config::get('default_ajax_return') : Config::get('default_return_type');$response = Response::create($data, $type);
  4. Json.php(Assume thatdefault_ajax_returnIsjson)

    $data = json_encode($data, $this->options['json_encode_param']);
  5. Respone.php

    Send ()-> call $ this. output ();-> call the output method of Json. php.

I have not read the source code. I guess it is to call a method, get the return value, and then output ......

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.