What should I do when spl_autoload_register fails to load?

Source: Internet
Author: User
How to deal with spl_autoload_register loading failure? I encountered two problems during my study today. first, I used WAMP and PHP5.3.9. when I learned to automatically load functions of the class. _ autoload ($ className) cannot be used for life or death. I echo it in it, but there is no output, so PHP does not automatically call it. what should I do when spl_autoload_register fails to load?
I encountered two problems during my study today. first, I used WAMP, PHP5.3.9,
When learning to automatically load a class function
1. _ autoload ($ className) is useless. I echo it in it, but no output, so PHP does not automatically call it.

2. when 1 does not work, I find spl_autoload_register, which is actually usable. But I have a question: how can I deal with this kind of file when there is no required class? For example, http: // localhost/index. php? Action = Unknow does not exist in this UnknowAction. class. php, which is fatal. I want to jump to another error. php page.

Thank you.

------ Solution --------------------
PHP code
  
------ Solution --------------------
If you want to jump, use the header function or output a piece of js to jump.
------ Solution --------------------
It's best not to use this. it's not flexible.

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.