webrium/core

PHP 框架


README

Latest Stable Version Total Downloads Latest Unstable Version License

Webrium Core

Webrium Core 提供了一系列功能,使得网站开发更加简单和快速。Core 用于开发 Webrium 框架,但如需,其所有或部分功能也可以在其他项目中使用。Webrium Core 包括路由、文件上传和下载、会话管理等设施。

文档

  1. 安装核心
composer require webrium/core
  1. 创建应用目录

  2. 在应用中创建 index.php 文件

index.php

<?php
require_once __DIR__ . '/../vendor/autoload.php';

use Webrium\App;
use Webrium\Debug;
use Webrium\Route;

Debug::showErrorsStatus(true);
Debug::writErrorsStatus(false);

// init index path
App::root(__DIR__);

Route::get('', function ()
{
  return ['message'=>'successful'];
});
  1. 在应用中创建 .htaccess 文件

.htaccess

AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

现在尝试

输出 (https:///app/)

{"message":"successful"}