How can I determine the definition of C controller in MVC? -Php Tutorial

Source: Internet
Author: User
I want to write the framework myself. how can I determine the defined functions in the controller? Let's say {code...} in the C controller and then enter the address index. phpc? Cpage & amp; aindex can be opened if index. phpc is not input illegally? Cpage & amp; aindex2 or index. phpc? Cpage & amp; ax... I want to write the framework myself. how can I determine the function defined in the controller?
For example

Class PageController {function index () {echo "single page ";}

Then enter the address index. phpc? C = page & a = index can be opened
If index. phpc? C = page & a = index2 or index. phpc? C = page & a = xxxx
The error message "Fatal error: Call to undefined method PageController: xxx ()" is returned for the function definition function ()

I want to achieve this. how can I determine whether a function or method does not exist and directly jump to 404?

function ???() { echo "404";} 

Reply content:

I want to write the framework myself. how can I determine the defined functions in the controller?
For example

Class PageController {function index () {echo "single page ";}

Then enter the address index. phpc? C = page & a = index can be opened
If index. phpc? C = page & a = index2 or index. phpc? C = page & a = xxxx
The error message "Fatal error: Call to undefined method PageController: xxx ()" is returned for the function definition function ()

I want to achieve this. how can I determine whether a function or method does not exist and directly jump to 404?

function ???() { echo "404";} 

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.