A thinkphp entry-level question

Source: Internet
Author: User
I am a newbie to thinkphp entry level question. I am confused when I am testing thinkphp today. please kindly advise:
The code is very simple. there is only one IndexAction (automatically generated), which contains an index method and a test method. the url mode I use is the rewrite mode ('URL _ model' => 2 ), the rewrite rules have been written, but they are always unsuccessful when accessing the test method. according to the manual, it should be http://www.admin.me/index/test. however, the test always reports an error: allow unauthorized access :test (regardless of the case at the beginning of index). why? Isn't the first parameter the module name, and the second parameter the operation name? How can there be two indexes here? My project folder is an App. please kindly advise on the file structure !!


Reply to discussion (solution)

The first one is the total entry file, the second index is your controller, that is, the file that inherits the action, and the third test is your method, that is, the code block function to be processed, I don't know. Are you clear about this ??? Hope to help you

The first one is the total entry file, the second index is your controller, that is, the file that inherits the action, and the third test is your method, that is, the code block function to be processed, I don't know. Are you clear about this ??? I hope to help you. thank you for your reply, but my file structure does not contain the index file name?

It seems that you have not followed the rules. you must comply with the TP rules,

It seems that you have not followed the rules. you must comply with the TP rules! I didn't do anything, so I only added a test function to IndexAction. Even the IndexAction is automatically generated by thinkphp. then, the URL mode is changed to 2 and a value is added. htaccess file (the content of this file is copied in the manual, and the rewrite rules cannot be wrong )...... That's all. The rest is the url access problem, which cannot violate the rules, right?

So you added the index. php file to the file in the same directory as THINK? You should write something in it,

 

You can see that there are a lot of configuration in the configuration of TP. you should not thank the method first. after completing the configuration, you will see the welcome interface and then go to the following ".

Wonderful. continue the discussion.

Let's take a look at thinkphp manual.

So you added the index. php file to the file in the same directory as THINK? You should write something in it,

 

You can see that there are a lot of configuration in the configuration of TP. you should not thank the method first. after completing the configuration, you will see the welcome interface and then go to the following ". Haha! I used ThinkPHP to build several projects. I still know this. thanks for the help. after multiple queries, I finally learned the results. The Thinkphp official website has suggested that this is a bug, for details, see Apache server enable URL rewriting to remove index. php causes all methods in IndexAction to fail to be parsed.

Let's take a look at thinkphp manual.
After multi-party queries, we finally know the results. Thinkphp's official website has suggested that this is a bug. for details, see Apache server enabling URL rewriting to remove index. php, leading to failure to parse all methods under IndexAction.

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.