thinkphp Learning Notes (i) thinkphp deployment _php Instance

Source: Internet
Author: User

Wampserver has been downloaded and there is time to try running thinkphp locally.

The controller class can be defined for each module under the App/lib/action/folder, a module can contain multiple action methods, and when requested, the current requested module and operation are parsed from the URL parameter. For example, the default controller class defined IndexAciton.class.php:

<?php
class Indexaction extends action{
  ptotect function _initialize () {
    header ("content-type:text/ Html;charset=utf-8 ");
  }
  Public Function Index () {
    $this->display ();
  }
  The Public Function Imit () {
    echo " 
 

Access to http://localhost/, the default action (index) is accessed by the system. Relative input http://localhost/Index/imit, the system accesses the default module (Index) Action method (Imit). This URL pattern is pathinfo mode, the default format for thinkphp, and other formats can be set in thinkphp/conf/convention.php, such as normal mode, rewrite mode, and compatibility mode.

Just notes, why can not be set to only themselves visible, I write a mess are embarrassed to show people ah.

The rewrite pattern for URL requests is the support for adding rewrite rules based on the pathinfo pattern, which, in the case of Apache, is added at the same level as the entry file. htaccess file, which reads:

<ifmodule mod_rewrite.c>
rewriteengine on
rewritecond%{request_filename}!-d
Rewritecond%{ Request_filename}!-f
rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]
</IfModule>

Only this is not possible, but also need to turn on the Apache rewrite function. In the httpd.conf configuration file, find the LoadModule rewrite_module modules/mod_rewrite.so remove the front #, find allowoverride None to allowoverride all. So it works.

Related Article

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.