本文整理汇总了PHP中Http::route方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::route方法的具体用法?PHP Http::route怎么用?PHP Http::route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::route方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init($cfg)
{
//! defaults
if (empty($cfg["sqldir"])) {
$cfg["sqldir"] = "data/temp";
}
if (empty($cfg["pagesdir"])) {
$cfg["pagesdir"] = "pages";
}
$this->pagesdir = $cfg["pagesdir"];
//! if it's a special sql refresh request
if (Core::$core->url == "sqlrefresh" || isset($_REQUEST["sqlrefresh"])) {
//look data source
if (!DS::db()) {
die("ERROR: no db");
}
//read the changes
$sqlFiles = @glob($cfg["sqldir"] . "/sqlchanges-*.sql");
foreach ($sqlFiles as $sf) {
//get sql commands from file
$sqls = str_getcsv(@file_get_contents($sf), ";");
@unlink($sf);
//execute one by one
foreach ($sqls as $query) {
DS::exec($query);
}
}
die("OK");
}
//! check if there's a CMS generated file for the url
//! if so, add route for it
$c = @explode("/", Core::$core->url);
while (!empty($c)) {
$f = implode("-SLASH-", $c);
if (file_exists($cfg["pagesdir"] . "/" . $f . ".php")) {
self::$page = $cfg["pagesdir"] . "/" . $f . ".php";
Http::route(Core::$core->url, "\\PHPPE\\EplosCMS");
break;
}
//if not found, put last part in parameters array
self::$params[] = array_pop($c);
}
//reverse the parameters as they were popped in reverse order
self::$params = @array_reverse(self::$params);
return true;
}
示例2: MultiServer
/**
* PHP Portal Engine v3.0.0
* https://github.com/bztsrc/phppe3/
*
* Copyright LGPL 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* <http://www.gnu.org/licenses/>
*
* @file vendor/phppe/MultiServer/init.php
* @author bzt
* @date 22 May 2016
* @brief
*/
namespace PHPPE;
Http::route("ms/add", "MultiServer", "addAction");
Http::route("ms/remove", "MultiServer", "removeAction");
Http::route("ms/set", "MultiServer", "setAction");
//! return your service class here
return new MultiServer();
示例3: L
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* <http://www.gnu.org/licenses/>
*
* @file vendor/phppe/Developer/init.php
* @author bzt
* @date 1 Jan 2016
* @brief Initialize Developer extension
*/
/*!SKIPAUTOLOAD!*/
namespace PHPPE;
//! register menu
View::menu(L("Developer"), [L("Tests") => "tests", L("Benchmarks") => "benchmark"]);
//! this is needed for test cases
Http::route("tests/httptest", "Developer", "action_httpget", "get");
Http::route("tests/httptest", "Developer", "action_httppost", "post");
//! register url routes.
Http::route("tests", "Developer");
Http::route("benchmark", "BenchmarkController");
//! these are CLI only
Http::route("mkrepo", "MkRepoController");
Http::route("minify", "MinifyController");
Http::route("create", "CreateController");
Http::route("lang", "LangController");
Http::route("pretty", "PrettyController");
//for event testing
return new Testing();
示例4: dump
public static function dump()
{
Http::mime('text/plain', false);
print_r(self::$o);
print_r($_SERVER);
print_r(Http::route());
die;
}
示例5: ClusterCli
/**
* PHP Portal Engine v3.0.0
* https://github.com/bztsrc/phppe3/
*
* Copyright LGPL 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* <http://www.gnu.org/licenses/>
*
* @file vendor/phppe/ClusterCli/init.php
* @author bzt
* @date 27 Sep 2016
* @brief
*/
namespace PHPPE;
//! add your routes here
Http::route("cluster/client", "\\PHPPE\\Ctrl\\ClusterCli", "client");
Http::route("cluster/bindcfg", "\\PHPPE\\Ctrl\\ClusterCli", "bindcfg");
//! return your service class here
return new ClusterCli();
示例6: DataLibrary
<?php
/**
* PHP Portal Engine v3.0.0
* https://github.com/bztsrc/phppe3/
*
* Copyright LGPL 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* <http://www.gnu.org/licenses/>
*
* @file vendor/phppe/DataLibrary/init.php
* @author bzt
* @date 27 May 2016
* @brief
*/
namespace PHPPE;
Http::route("download", "DataLibrary", "action");
return new DataLibrary();
示例7:
*
* Copyright LGPL 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* <http://www.gnu.org/licenses/>
*
* @file vendor/phppe/ClusterSrv/init.php
* @author bzt
* @date 27 Sep 2016
* @brief
*/
namespace PHPPE;
//! add your routes here
Http::route("cluster/server", "\\PHPPE\\Ctrl\\ClusterSrv", "server");
Http::route("cluster/takeover", "\\PHPPE\\Ctrl\\ClusterSrv", "takeover");
Http::route("cluster/flush", "\\PHPPE\\Ctrl\\ClusterSrv", "flush");
Http::route("cluster/deploy", "\\PHPPE\\Ctrl\\ClusterSrv", "deploy");
Http::route("cluster/help", "\\PHPPE\\Ctrl\\ClusterSrv", "help");
Http::route("cluster", "\\PHPPE\\Ctrl\\ClusterSrv", "action");
//! return your service class here
//return new ClusterSrv;