thinkphp Loading and Url_model

Source: Internet
Author: User

1. Load thinkphp.php

Requrie ('./thinkphp/thinkphp.php ');

2. Load the core file./thinkphp/lib/core

3. Load the project's file analysis URL to invoke the associated controller

M Module Controller

A Action Method action= page

Muke.com/index.php?m=index&a=index

Custom configuration Files

Add define (' App_debug ', true) to the boot entry;

You can add any configuration file, such as user.php, under the Conf directory.

<?php
Return Array (
' Username ' = ' username2 ',
);

?>

Add the extension profile entry in the config.php file when you are finished adding:

' Load_ext_config ' = ' user ',

The custom profile is loaded every time and should not be recommended.

Url_model

Add Configuration in config.php

' Url_model ' =>3,

1. Default mode pathinfo Mode 1 http://muke.com/index.php/Index/user/id/1.html

0 Common mode Most traditional normal mode http://muke.com/index.php?m=Index&a=user&id=1

2 rewrite mode http://muke.com/Index/user/id/1.html

3 Compatibility Mode http://muke.com/index.php?s=/Index/user/id/1.html

echo C (' Url_model '); Get Url_model Configuration

echo U (' Index/user ', array (' ID ' =>1), ' HTML ', FALSE, ' muke.com ');

About Url_model mode is 2 when overriding the pattern, hiding out how index.php is implemented:

1. Modify httpd.conf find rewrite.so to remove the # number in front of the line and restart the service after saving

2. Add the file named. htaccess to the location of the project root directory and the index.php directory, and the content is added as follows:

<ifmodule mod_rewrite.c>

Rewriteengine on

Rewritecond%{request_filename}!-d

Rewritecond%{request_filename}!-f

Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]

</Ifmodule>

Ok.url_model 2 mode can be accessed, and address rewriting succeeds.

thinkphp Loading and Url_model

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.