当前位置: 首页>>代码示例>>PHP>>正文


PHP F3::route方法代码示例

本文整理汇总了PHP中F3::route方法的典型用法代码示例。如果您正苦于以下问题:PHP F3::route方法的具体用法?PHP F3::route怎么用?PHP F3::route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在F3的用法示例。


在下文中一共展示了F3::route方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: json_encode

        }
    } else {
        $data = json_encode($doc);
    }
    $cb = getparam('callback');
    if ($cb) {
        echo $cb . '(' . $data . ')';
    } else {
        echo $data;
    }
}
F3::route('POST /@db/objects/@model', function () {
    $dbName = F3::get('PARAMS["db"]');
    $model = F3::get('PARAMS["model"]');
    $doc = json_decode(file_get_contents('php://input'));
    if (!isset($doc->_id)) {
        $doc->_id = $model;
    }
    $response = saveDocument($dbName, $doc, true);
    if (isset($response->rev)) {
        $doc->_rev = $response->rev;
    }
    wrapResponse($response, $doc);
});
F3::route('GET /@db/objects/@model', function () {
    $dbName = F3::get('PARAMS["db"]');
    $model = F3::get('PARAMS["model"]');
    $response = getDocument($dbName, $model);
    wrapResponse($response, $response);
});
F3::run();
开发者ID:eeejayg,项目名称:F5UXP,代码行数:31,代码来源:index.php

示例2: rock

<!--
1)

Url:   http://192.168.56.101/
Çıktı: We rock!We roll....

2)

Url:   http://192.168.56.101/
Çıktı: We rock!What's a rattle?We roll....

-->

<?php 
require_once 'F3/F3.php';
F3::route('GET /', 'rock|roll');
function rock()
{
    echo 'We rock!';
}
function roll()
{
    echo 'We roll...';
}
F3::route('GET /barrel', 'rock|rattle|roll');
function rattle()
{
    echo 'What\'s a rattle?';
}
F3::run();
开发者ID:seyyah,项目名称:f3,代码行数:30,代码来源:3multi_route.php

示例3: home

<?php

require_once 'lib/base.php';
F3::route('GET /', 'home');
function home()
{
    echo 'Hello world';
}
F3::run();
开发者ID:simonfork,项目名称:phpmark,代码行数:9,代码来源:index.php

示例4: function

<?php

require __DIR__ . '/lib/base.php';
F3::set('CACHE', FALSE);
F3::set('DEBUG', 1);
F3::set('UI', 'ui/');
F3::route('GET /index.php', function () {
    F3::set('modules', array('apc' => 'Cache engine', 'gd' => 'Graphics plugin', 'hash' => 'Framework core', 'imap' => 'Authentication', 'json' => 'Various plugins', 'ldap' => 'Authentication', 'memcache' => 'Cache engine', 'mongo' => 'M2 MongoDB mapper', 'pcre' => 'Framework core', 'pdo_mssql' => 'SQL handler, Axon ORM, Authentication', 'pdo_mysql' => 'SQL handler, Axon ORM, Authentication', 'pdo_pgsql' => 'SQL handler, Axon ORM, Authentication', 'pdo_sqlite' => 'SQL handler, Axon ORM, Authentication', 'session' => 'Framework core', 'sockets' => 'Network plugin', 'xcache' => 'Cache engine'));
    echo Template::serve('welcome.htm');
});
F3::run();
开发者ID:groupdocs,项目名称:groupdocs-php,代码行数:11,代码来源:index.php

示例5: function

    F3::set('config_permissions', $settings->config_permissions);
    $status_buttons = Template::serve('ui/status_buttons.html');
    F3::set('status_buttons', Template::serve('ui/status_buttons.html'));
    F3::set('content', Template::serve('ui/settings.html'));
    echo Template::serve('ui/template.html');
}
*/
F3::route('GET /settings', function () {
    global $settings;
    $settings->settings_page_data();
    F3::set('company_logos', $settings->company_logos);
    //        F3::set('debug', $settings->debug);
    F3::set('config_permissions', $settings->config_permissions);
    $status_buttons = Template::serve('ui/status_buttons.html');
    F3::set('status_buttons', Template::serve('ui/status_buttons.html'));
    F3::set('content', Template::serve('ui/settings.html'));
    echo Template::serve('ui/template.html');
});
F3::route('GET /set_permissions', function () {
    global $settings;
    $settings->set_permissions();
    F3::reroute('/settings');
});
F3::route('POST /save_settings', function () {
    $post_data = $_POST;
    $settings = new Settings();
    $settings->save();
    F3::reroute('/settings');
});
F3::route('GET /debug', 'debug.php');
F3::run();
开发者ID:retorick,项目名称:scalex-portal,代码行数:31,代码来源:index.php

示例6: function

    $access->policy('deny');
    $access->allow('/admin/*', 'admin');
    $access->allow('GET|POST /admin/Auth*');
    $access->allow('GET|POST /admin/auth*');
    if (!$f3->exists('SESSION.user_type') && !$f3->exists('COOKIE.user')) {
        $f3->set('SESSION.user_type', 'guest');
    }
    $access->authorize($f3->get('SESSION.user_type'), function ($route, $subject) {
        \F3::reroute('@admin_pack(@pack=Auth)');
    });
    /* 
    	Default settings for template #1
    */
    if ($f3->exists("COOKIE.user") or $f3->exists("SESSION.user")) {
        $userz = \User::createUser(\kksd\Sesi::$DB);
        $userz->load(array('id=?', $f3->exists("COOKIE.user") ? $f3->COOKIE['user'] : $f3->SESSION['user']));
        $f3->set("system.user", $userz);
    }
    \Template::instance()->extend('php', function ($args) {
        $html = isset($args[0]) ? $args[0] : '';
        return "<?php {$html} ?>";
    });
});
\F3::route("GET  @admin:      /admin", "\\Control\\Admin\\App->home");
\F3::route("GET  @admin_home: /admin/dash", "\\Control\\Admin\\App->dash");
\F3::route("GET  @admin_pack: /admin/@pack", "\\Control\\Admin\\@pack->index");
\F3::route("POST @admin_pack", "\\Control\\Admin\\@pack->post_index");
\F3::route("GET  @admin_pack_func: /admin/@pack/@func", "\\Control\\Admin\\@pack->get_@func");
\F3::route("POST @admin_pack_func", "\\Control\\Admin\\@pack->post_@func");
\Middleware::instance()->run();
//we've settinged a middleware, be4.
开发者ID:Kekesed,项目名称:Kambeng-Blog,代码行数:31,代码来源:router.php

示例7: render

<?php

include 'lib/F1.php';
F3::set('template', 'goster');
function render()
{
    echo F3::serve('layout.htm');
}
F3::config(".f3.ini");
F3::route("GET {$F3}/captcha", ':captcha');
F3::route("GET {$F3}/", ':goster');
F3::route("GET {$F3}/cikti", ':cikti');
F3::route("POST {$F3}/kaydet", ':kaydet');
F3::route("GET {$F3}/sorgu", ':sorgual');
F3::route("POST {$F3}/sorguyap", ':sorguyap');
F3::route("GET {$F3}/sorgucikti", ':sorgucikti');
F3::run();
?>

开发者ID:seyyah,项目名称:uzkay,代码行数:18,代码来源:index.php

示例8: main

<!--

Url:   http://192.168.56.101/
Çıktı: Hello world

-->

<?php 
require_once 'F3/F3.php';
F3::route('GET /', 'main');
function main()
{
    F3::set('name', 'world');
    F3::set('buddy', array('Tom', 'Dick', 'Harry'));
    F3::set('gender', 'M');
    F3::set('loggedin', 'true');
    F3::set('div', array('coffee' => array('arabica', 'barako', 'liberica', 'kopiluwak'), 'tea' => array('darjeeling', 'pekoe', 'samovar')));
    F3::set('rows', array(1, 2, 3, 4, 5));
    echo F3::serve('5template.htm');
}
F3::run();
开发者ID:seyyah,项目名称:f3,代码行数:21,代码来源:5template.php

示例9: drink

<!--Usage: 
Url:   http://192.168.56.101/brew/1
Çıktı: http://192.168.56.101/brew/1
http://fatfree.sourceforge.net/#router
-->

<?php 
require_once 'F3/F3.php';
F3::route('GET /brew/@count', 'drink');
function drink()
{
    echo F3::get('PARAMS["count"]') . ' bottles of beer on the wall.';
}
F3::run();
开发者ID:seyyah,项目名称:f3,代码行数:14,代码来源:2route.php

示例10: home

<?php

require __DIR__ . '/lib/base.php';
include_once 'avro.php';
F3::route('GET /', 'home');
function home()
{
    echo "Hello, X.commerce! You should be posting to /cse/offer/create\n";
}
F3::route('GET /testphp', function () {
    echo print_r(get_loaded_extensions(), true);
    echo print_r(phpInfo(), true);
});
F3::route('POST /cse/offer/create', 'cse');
function cse()
{
    // Open the log file to which to write outputs
    $fp = fopen('test.log', 'at');
    // Get all http headers in the received message
    $headers = getallheaders();
    // Get the posted message body
    // NOTE: The message body is currently in Avro binary form
    $post_data = file_get_contents("php://input");
    // Get the URI of the Avro schema on the OCL server that adheres to the /cse/offer/create contract
    $schema_uri = $headers['X-XC-SCHEMA-URI'];
    // Get the contents of the Avro schema identified by the URI retrieved above
    $content = file_get_contents($schema_uri);
    // Parse the CSE Avro schema and place results in an AvroSchema object
    $schema = AvroSchema::parse($content);
    //fwrite($fp, $schema);
    //fwrite($fp, "\n");
开发者ID:rfmcpherson,项目名称:Sample-capabilities,代码行数:31,代码来源:index.php

示例11: curl_setopt

    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: avro/json", "Authorization: " . F3::get('SESSION.ship_token'), "X-XC-MESSAGE-GUID-CONTINUATION: ", "X-XC-WORKFLOW-ID: " . F3::get('wf_id'), "X-XC-TRANSACTION-ID: " . F3::get('transaction_id'), "X-XC-SCHEMA-VERSION: " . F3::get('SESSION.ship_ver')));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $write_io->string());
    $response = curl_exec($ch);
    echo $response;
});
F3::route('POST /reset', function () {
    F3::set('SESSION.cart_token', "Bearer EmD5+rI5JWO0w4DEev8+HQMYOszwD6M8FoXG9J/50GBSE8LDeOCjOFqf4XwGKHmfS+y13vd4");
    F3::set('SESSION.ship_order_token', "Bearer EmD5+rI5JWO0w4DEev8+HQMYOszwD6M8FoXG9J/50GBSE8LDeOCjOFqf4XwGKHmfS+y13vd4");
    F3::set('SESSION.ship_token', "Bearer DTnGqOEPTffZyQ/byw/IwTedDIhtL+m3P+EsCI4br/dtNc5njBCx217Imh3QPGyBH2cFa5XE");
    $return_array = array("ctoken" => F3::get('SESSION.cart_token'), "stoken" => F3::get('SESSION.ship_token'));
    echo json_encode($return_array);
});
F3::route('POST /update', function () {
    if (!empty($_POST["cart_token"])) {
        F3::set('SESSION.cart_token', $_POST["cart_token"]);
        error_log(F3::get('SESSION.cart_token'));
    }
    if (!empty($_POST["cart_token"])) {
        F3::set('SESSION.ship_order_token', $_POST["cart_token"]);
    }
    if (!empty($_POST["ship_token"])) {
        F3::set('SESSION.ship_token', $_POST["ship_token"]);
    }
    error_log(print_r($_POST, true));
    // F3::reroute('/');
    $return_array = array("ctoken" => F3::get('SESSION.cart_token'), "stoken" => F3::get('SESSION.ship_token'));
    echo json_encode($return_array);
});
F3::run();
开发者ID:rhaggard,项目名称:php-starter-template,代码行数:31,代码来源:index.php

示例12:

<?php

// Application Configuration
include "../config.php";
// PHP Fat Free Framework (http://fatfree.sourceforge.net/)
require_once __SITE_PATH . "/library/F3/lib/base.php";
// Framework Configuration and Database Info
require_once __SITE_PATH . "/F3Config.php";
// Autoload Assets
F3::set('AUTOLOAD', __SITE_PATH . "/application/controllers/|" . __SITE_PATH . "/application/models/|" . __SITE_PATH . "/library/F3/lib/");
// Framework Variables
F3::set('GUI', __SITE_PATH . "/application/views/");
// Application Routes
F3::route('GET /', "RootController->get");
F3::route('GET /about', "RootController->about");
F3::route('GET /loot', "LootDirectoryController->get", 604800);
F3::route('GET /loot/@item', "LootController->get", 3600);
F3::route('GET /search', "SearchController->get");
F3::route('GET /ajax/loot', "AjaxController->loot");
// Let's Roll Out, Autobots!
F3::run();
开发者ID:huckfinnaafb,项目名称:leviatha,代码行数:21,代码来源:index.php

示例13: View

    } else {
        F3::reroute('/admin');
    }
    $view = new View();
    echo $view->render('layout.htm');
});
F3::route('GET /admin/list', function () {
    (new app\controllers\GalleryController())->viewAll();
});
F3::route('GET /admin/upload', function () {
    F3::set('html_title', 'My Blog Create');
    F3::set('content', 'admin_edit.html');
    if (!F3::get('SESSION.user')) {
        F3::set('content', 'security.html');
    }
    $view = new View();
    echo $view->render('upload.html');
});
F3::route('POST /admin/loadToServer', function () {
    echo (new app\controllers\UploadController())->load();
});
F3::route('DELETE /admin/deleteFromServer/@id', function () {
    echo (new app\controllers\UploadController())->delete();
});
F3::route('GET /admin/delete/@name', function () {
    (new app\controllers\GalleryController())->delete(F3::get('PARAMS.name'));
});
F3::route('GET /admin/addToGallery', function () {
    (new app\controllers\GalleryController())->loadAll();
});
F3::run();
开发者ID:CiNiK,项目名称:lisar,代码行数:31,代码来源:index.php

示例14: tester

F3::route('GET /delete/@cn', ':erasekul');
F3::route('GET /rename/@cn', ':todo');
// Logout
F3::route('GET /logout', ':logout');
// RSS feed
F3::route('GET /rss', ':rss');
// Generate CAPTCHA image
F3::route('GET /captcha', ':captcha');
F3::route('GET /ldap/search', ':ldap_search');
F3::route('GET /ldap/modify', ':ldap_modify');
F3::route('GET /ldap/create', ':ldap_add');
F3::route('GET /ldap/erase', ':ldap_erase');
F3::route('GET /ldap/rename', ':ldap_rename');
F3::route('GET /ldap/compare', ':ldap_compare');
F3::route('GET /info', ':info');
F3::route('GET /tester/@foo', 'tester');
function tester()
{
    echo F3::get('PARAMS.foo');
}
// Execute application
F3::run();
/**
	The function below could have been saved as an import file (render.php)
	loaded by the F3::route method like the other route handlers; but let's
	embed it here so you can see how you can mix and match MVC functions
	and import files.

	Although allowed by Fat-Free, functions like these are not recommended
	because they pollute the global namespace, specially when it's defined
	in the main controller. In addition, the separation of the controller
开发者ID:seyyah,项目名称:f3ldap,代码行数:31,代码来源:index.php

示例15: render

<?php

//include 'lib/F1.php';
require_once 'lib/F3.php';
function render()
{
    echo F3::serve('layout.htm');
}
F3::config(".f3.ini");
F3::route("GET /captcha", ':captcha');
F3::route("GET /min", ':minified', 3600);
F3::route("GET /", ':home');
F3::route("GET /create", ':createkul');
F3::route("POST /create", ':savekul');
F3::route("GET /test", "test");
function test()
{
    echo F3::serve("example.htm");
}
F3::route("GET /ajax/adresAjax/@parameter", ":adresAjax");
F3::route("GET /ajax/tc/@tc", ":tc");
F3::run();
?>

开发者ID:seyyah,项目名称:f3kayOLD,代码行数:23,代码来源:index.php


注:本文中的F3::route方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。