<p id="xiz5c"><strike id="xiz5c"></strike></p>

  • \r\n  

    my方法的顯示視圖<\/h1>\r\n<\/body>\r\n<\/html><\/pre>

    <\/p>\n


    <\/p>\n

    3. Testing and Execution<\/p>\n

    You should first understand how Zend Framework handles HTTP requests. By default, the first part of the URL is mapped to a controller, and the second part is mapped to the Action method in the controller class. <\/p>\n

    The execution result is shown in the figure below: <\/p>\n

    \"Zend<\/p>\n

    I hope this article will be helpful to everyone’s PHP program design based on the Zend Framework framework. <\/p>\n

    For more detailed Zend Framework introductory application examples and related articles, please pay attention to the PHP Chinese website! <\/p>"}

    国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

    Home php教程 PHP開發(fā) Detailed explanation of Zend Framework entry application examples

    Detailed explanation of Zend Framework entry application examples

    Jan 05, 2017 am 10:46 AM

    The example in this article describes the Zend Framework entry-level application. Share it with everyone for your reference, the details are as follows:

    .htaccess file

    .htaccess file is used to implement URL reset, that is, when the user accesses a resource, it will be redirected to the specified under the file.

    Code example:

    RewriteEngine on
    RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

    Among them, line 1 means that the reset engine is turned on, and line 2 means that when accessing other than js, ico, gif, jpg, png, css file,

    will be reset to the index.php file.

    Note:

    This rewrite rule can only be used on the Apache server and requires the use of the Apache redirection module. To be effective, the function must be enabled. Confirm that

    #LoadModule rewrite_module modules/mod_rewrite.so

    under Apache's httpd.conf configuration file is turned on, that is, remove the # sign.

    Automatically generate directory

    After decompressing the downloaded zend, there will be two core directories, one is library and the other is bin. There is a zf.bat file under bin that can be used to intelligently generate the Zend Framework directory structure.

    But certain configuration must be done before use, that is, the configuration of environment variables. Only in this way can its commands be called directly. Otherwise the build command cannot be called.

    1. Configure environment variables

    The configuration process is as shown in the figure:

    Zend Framework入門應(yīng)用實(shí)例詳解

    After adding the path, you can directly enter the "small Black box", that is, the instruction is directly called in CMD. Two are configured here, one is the bin directory under zend, and the other is the php directory under xampp. Because the instructions need to use some files in these two directories.

    2. Whether the test is successful

    Zend Framework入門應(yīng)用實(shí)例詳解

    #The above message appears, indicating that the environment variable configuration is successful.

    3. Execute the generation command

    zf create project zfdemo

    Zend Framework入門應(yīng)用實(shí)例詳解

    At this time, a project directory will be generated, as shown in the above prompt. There will be a directory zfdemo under the C drive.

    Zend Framework入門應(yīng)用實(shí)例詳解

    4. Copy the information in the directory to the project folder and test

    The entry file here is under public

    So in Enter the address "http://localhost/zendDemo/public/"

    Note: The name of the project is zendDemo

    If nothing goes wrong, you will see the successful execution result. . As shown in the figure below:

    Zend Framework入門應(yīng)用實(shí)例詳解

    #Note: Because I rewrote the default view file content, all I saw were the four words "Hello World".

    Transformation

    1. Create your own controller

    Create a controller named SelfController.php in the application/controllers/ directory and enter the following code.

    <?php
    class SelfController extends Zend_Controller_Action{
      public function selfAction(){
        //self方法
      }
      public function myAction(){
        //my方法
      }
    }

    The above code defines a SelfController class, and defines the selfAction() method and myAction() method in this class.

    2. Create the corresponding view file

    Create the self.phtml file in the application/views/scripts/self/ directory, the code is as follows:

    <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
       t tle>self方法的顯示視圖</title>
    </he  >
      <h1> self方法的顯示視圖</h1>
    </body


    Continue to create the my.phtml file in the same directory, the code is as follows:

    <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
      <title>my方法的顯示視圖</title>
    </head>
    <body>
      <h1>my方法的顯示視圖</h1>
    </body>
    </html>


    3. Testing and Execution

    You should first understand how Zend Framework handles HTTP requests. By default, the first part of the URL is mapped to a controller, and the second part is mapped to the Action method in the controller class.

    The execution result is shown in the figure below:

    Zend Framework入門應(yīng)用實(shí)例詳解

    I hope this article will be helpful to everyone’s PHP program design based on the Zend Framework framework.

    For more detailed Zend Framework introductory application examples and related articles, please pay attention to the PHP Chinese website!

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)