• 初始化一个yaf项目


    初始化一个yaf项目

    进入安装包目录下

    cd /usr/local/yaf-yaf-3.0.9/tools/cg
    

    创建项目

    sudo ./yaf_cg 项目名
    

    执行之后,将会生成一个文件夹,在output文件夹中。

    将项目拷出,然后配置nginx等等即可

    server
        {
            listen 80;
            #listen [::]:80;
            server_name jiqing.yaf.com ;
            index index.html index.htm index.php;
            root  /home/wwwroot/default/yaf/cheetah;
    
            #error_page   404   /404.html;
    
    
            include enable-php7.2.conf;
    
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }
    
            location ~ .*.(js|css)?$
            {
                expires      12h;
            }
    
            location ~ /.well-known {
                allow all;
            }
    
            location ~ /.
            {
                deny all;
            }
    
            access_log  /home/wwwlogs/access.yaf.log;
    }
    

    修改hosts

    sudo vim /etc/hosts
    

    访问

    更改index.php位置

    增加public目录

    修改nginx配置

    server
        {
            listen 80;
            #listen [::]:80;
            server_name jiqing.yaf.com ;
            index index.html index.htm index.php;
            root  /home/wwwroot/default/yaf/cheetah/public;
    
            #error_page   404   /404.html;
    
    
            include enable-php7.2.conf;
    
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }
    
            location ~ .*.(js|css)?$
            {
                expires      12h;
            }
    
            location ~ /.well-known {
                allow all;
            }
    
            location ~ /.
            {
                deny all;
            }
    
            access_log  /home/wwwlogs/access.yaf.log;
    }
    

    更改路径方式1

    修改index.php

    <?php
    
    define('APPLICATION_PATH', dirname(__FILE__));
    
    $application = new Yaf_Application( APPLICATION_PATH . "/../conf/application.ini");
    
    $application->bootstrap()->run();
    ?>
    
    

    修改配置application.ini

    [common]
    application.directory = APPLICATION_PATH  "/../application"
    application.dispatcher.catchException = TRUE
    
    [product : common]
    
    

    更改路径方式2

    直接这样改index.php

    define('APPLICATION_PATH', dirname(__FILE__).'/../');
    

    修改fastcgi.conf

    fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/home/wwwroot/default/:/tmp/:/proc/";
    

    重启lnmp

    sudo lnmp restart
    

    yaf 目录结构

    
    + public
      |- index.php //入口文件
      |- .htaccess //重写规则    
      |+ css
      |+ img
      |+ js
    + conf
      |- application.ini //配置文件   
    + application
      |+ controllers
         |- Index.php //默认控制器
      |+ views    
         |+ index   //控制器
            |- index.phtml //默认视图
      |+ modules //其他模块
      |+ library //本地类库
      |+ models  //model目录
      |+ plugins //插件目录
    
  • 相关阅读:
    python2的比较函数,cmp
    快速排序
    如果a,b,c为自然数,a+b+c=1000,a方+b方=c方,求出abc可能的组合(python实现)
    python之join
    python之functools partial
    Python 3 iter函数用法简述
    python线程之condition
    python 线程 event
    getattr getattribute setattr hasattr delattr
    Properties类
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/12083710.html
Copyright © 2020-2023  润新知