Code Monkey home page Code Monkey logo

phpspot's Introduction

phpspot 框架
特性:
1. 每个page文件只提供一个访问方法,如page_index 类只提供get 和 post 方法对外访问, 兼容ngnix
2. 提供虚拟目录功能支持


使用:
1. index.php
require('phpspot.class.php');
$app = new phpspot();
$app->set_app_dir(dirname(__FILE__));
$app->alias('/vv/', '/page/admin'); //虚拟目录

2. page/index.class.php
class page_index extends page_base{
    function get(){
    }
}

规范:
1. class 文件应该以 '.class.php'结尾, 如page/index.class.php
2. class 名称命名应该为 目录(多级目录用_衔接)+文件名(不要后缀), 如page/index.class.php 类名为page_index
3. 创建单例应该用$a = __new__('page_index', $argv1, $argv2, ....); 

Apache Rewrite:
RewriteEngine   on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

ngnix rewrite:
if (-f $request_filename) {
	break;
}
if (-d $request_filename) {
	break;
}
rewrite ^/(.*)$ /index.php?__path__=$1 last;

phpspot's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.