Why is my webpage slow?

Source: Internet
Author: User
Why is my webpage slow? Let's look at the code first. PHPcodeclassAdmin_ControllerextendsCI_Controller {publicfunction _ construct () {parent ::__ construct (); $ this-& gt; _ init_user (); why is my webpage slow?
Check the code first.
PHP code
  Class Admin_Controller extends CI_Controller {public function _ construct () {parent ::__ construct (); $ this-> _ init_user ();} // initialize user private function _ init_user () {if (! Empty ($ _ SESSION ['name']) {redirect ('manager');} else {redirect ('login ');}}


PHP code
  class Management extends Admin_Controller {    public function index()    {        $this->load->view('management');    }


PHP code
  class Login extends Admin_Controller {    public function index()    {        $this->load->view('login');    }        public function logins()    {        if($_POST['name'] == "admin" && $_POST['passwd'] == "123456")        {            $_SESSION['name'] = $_POST['name'];            redirect('management');        }        else        {            redirect('login');        }    }}


Now, the problem is that when I add $ this-> _ init_user () in the top-level constructor, the webpage is slow to refresh or log on. Why?

------ Solution --------------------
Not yet.
------ Solution --------------------
Is session_start () enabled? It is best to add an isset ($ _ SESSION ['name']).
Personal ignorance
------ Solution --------------------
YSlow browser plug-in, analyze the web page, very detailed
------ Solution --------------------
It's easy. your webpage is redirected cyclically.

When you have logged on to the management console, _ init_user redirects you to the management console.
When login is not logged on, it is redirected to login again.
So reciprocating
------ Solution --------------------
Sequence problems.

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.