使用作曲家,通过uri REQUEST_URI调用类不要工作吗?

时间:2016-10-22 10:12:16

标签: php composer-php

http://impare.local/postgres/Update

url 2是更新,但不要调用该类!

namespace postgres;    
require "vendor/autoload.php";

use postgres\Connection as Connection;<br>
use postgres\CreateTables as CreateTables;<br>
use postgres\UpdateTables as UpdateTables;<br>
use postgres\Stocs as Stocs;<br>
use postgres\persons\Persons as Persons;<br>
use postgres\core\Route as Route;<br>
use postgres\persons\Update as Update;<br>

$url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
$url = explode('/', rtrim($url, '/'));    

$class = $url[2];
$controller = new $class(); //Update Class

0 个答案:

没有答案