zoukankan      html  css  js  c++  java
  • yaf安装配置

      简单了解yaf之后,开始进行yaf的配置,我使用的是php+nginx+mysql,在window系统下安装。

      第一步   将yaf.dll,yar.dll放到php\ext目录下

      第二步    在php.ini里加入extension=yaf.dll   extension=yar.dll

      第三步,重启服务器,在一个php文件里输入phpinfo(),运行,如果出现yaf的版本信息,则安装成功

      

      yaf的目录结构

      -index.php       //入口文件

      -public

      -conf

        --application.ini        //配置文件

      -application

        --controllers

          ---index.php          //默认控制器

        --views

          ---index                //控制器

            ----index.phtml   //默认视图

        --modules  //其他模块

        --library    //本地类库

        --models   //model目录

        --plugins  //插件目录  

      index.php入口文件的内容:

        define("APP_PATH", dirname(__FILE__));

        $app = new Yaf_Application(APP_PATH."/conf/application.in");

        $app->run();

      Nginx.conf修改:

        server{

        listen 80;

        server_name   www.yaf.com;

        root    你的应用所在的目录;

        index  index.php index.html index.htm;

        

        if (!-e $request_filename) {     rewrite ^/(.*)  /index.php/$1 last;   }

          location ~* \.php$ {   include php.conf;  }

        }

      

      yaf配置时遇到的问题:

      把rewrite ^/(.*)  /index.php/$1 last;改成rewrite ^/(.*)  /index.php?$1 last;

      以前看了篇帖子讲了原因的,不过忘记了。

      默认控制器application/controllers/Index.php

        class IndexController extends Yaf_Controller_Abstract

      {

        public function indexAction()

        {

          $this->getView()->assign("content", "hello world");

        }

      }

      然后在浏览器中输入   www.yaf.com就可以看到hello world 了。

      

      

  • 相关阅读:
    PEP20: The Zen of Python
    画三角形
    前端优化总结
    Doctype的作用以及严格模式和混杂模式的区别
    JS循环添加事件
    数据库整理用到的
    ASP.NET中url路径中?和= 被转码成%3f 和 %3d带来的问题。
    ReSharper Abbreviations List, 怎么管理缩写列表
    怎样使用 ASP.NET Optimization Bundling压缩样式表和脚本
    jQuery 选择同时包含两个class的元素
  • 原文地址:https://www.cnblogs.com/eyeSpace/p/3768462.html
Copyright © 2011-2022 走看看