ThinkPHP study notes (1) ThinkPHP deployment

Source: Internet
Author: User
I installed ThinkPHP and SAE engines on Sina's SAE. I directly installed the source code package and started Memcache and MySql services to run successfully. ThinkPHP

You have downloaded the wampserver and will try to run ThinkPHP locally later.

In the app/lib/Action/folder, you can define a controller class for each module. a module can contain multiple operation methods. when there is a request, the module and operation of the current request are parsed from the URL parameter. For example, the default controller class IndexAciton. class. php is defined as follows:

<? Phpclass IndexAction extends Action {ptotect function _ initialize () {header ("Content-Type: text/html; charset = utf-8");} public function index () {$ this-> display ();} public function imit () {echo "Sae service simulator function test (the following services can also be run locally ):";}}

Access http: // localhost/. The system accesses the default operation (Index) of the default module ). If you input http: // localhost/Index/imit, the system will access the default module (Index) operation method (imit ). This URL mode is the PATHINFO mode, which is the default format of ThinkPHP. you can also set other formats in ThinkPHP/Conf/convention. php, such as normal mode, REWRITE mode, and compatibility mode.

It's just a note. Why can't I set it to only visible by myself? I am so embarrassed to show it to others.

The REWRITE mode of a URL request is supported by adding REWRITE rules based on the PATHINFO mode. for Apache, The. htaccess file is added at the same level of the entry file. the content is:

 
  RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
 

This is not the case. you also need to enable the rewrite function of Apache. Find LoadModule rewrite_module modules/mod_rewrite.so in the httpd. conf configuration file and remove the previous #. change AllowOverride None to AllowOverride All. This is valid.

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.