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


PHP Route::param方法代码示例

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


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

示例1: matchURI

 public static function matchURI($uri = null)
 {
     $path_info = !empty($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : (!empty($_SERVER['ORIG_PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : '');
     $uri = !$uri ? $path_info : $uri;
     $uri = !$uri ? '/' : rtrim($uri, "\\/");
     if (!empty(self::$request)) {
         $count = count(self::$request);
         for ($i = 0; $i < $count; ++$i) {
             foreach (self::$request[$i] as $k => $v) {
                 if (is_array($v) and $k !== 'param') {
                     self::$param = self::$request[$i]['param'];
                     $v['request'] = preg_replace_callback("/\\<(?<key>[0-9a-z_]+)\\>/", 'Route::_replacer', str_replace(")", ")?", $v['request']));
                     $rulleTemp = array_merge((array) self::$request[$i], (array) $v);
                     if ($t = self::_reportRulle($rulleTemp, $uri)) {
                         return $t;
                     }
                 }
             }
         }
     } else {
         return array();
     }
 }
开发者ID:pauloarguelo,项目名称:RotaMvc,代码行数:23,代码来源:Route.php

示例2: Comment

<?php

#1. LOGIC
Auth::kickout('/pokecart/');
$comment = new Comment();
$comment->load(Route::param('id'));
if ($comment->user_id == Auth::user_id()) {
    if (Input::posted()) {
        $comment->content = Input::get('message');
        $comment->save();
        URL::restore();
    }
}
Sticky::set('message', $comment->content);
#2. LOAD VIEWS
include VIEWS . 'header.php';
include VIEWS . 'edit_comment.php';
include VIEWS . 'footer.php';
开发者ID:sean01,项目名称:pokecart,代码行数:18,代码来源:edit_comment.php

示例3: Project

<?php

# new_task.php
# 1. logic
$project = new Project();
$project->load(['slug' => Route::param('slug')]);
if (Input::posted()) {
    $task = new Task();
    $task->fill(Input::all());
    $task->user_id = Auth::user_id();
    $task->project_id = $project->id;
    if (Input::get('name') != "" || Input::get('description') != "") {
        $task->save();
    }
}
URL::redirect('/' . $project->slug);
开发者ID:Wade-Nairn,项目名称:get-it-done-WE04,代码行数:16,代码来源:new_task.php

示例4: Token

<?php

# controllers/resetpw.php
# Logic
$token = new Token();
# load the token by the value in the url
$token->load(['value' => Route::param('value')]);
$today_dt = strtotime(date('Y-m-d H:i:s'));
$token_dt = strtotime($token->expiration);
if ($today_dt < $token_dt) {
    # create a new user
    $user = new User();
    # load the user with the id found in the token
    $user->load($token->user_id);
    # if the form was posted
    if (Input::posted()) {
        # set the users password to the new hash
        $user->password = password_hash(Input::get('password'), PASSWORD_DEFAULT);
        # and save it
        $user->save();
        # log that user in
        Auth::log_in($user->id, $user->is_admin);
        # hard delete the token
        $token->hard_delete();
        # Redirect wherever you want to go after that.
        if (Auth::is_admin()) {
            URL::redirect('/admin');
        } else {
            URL::redirect('/');
        }
    }
开发者ID:reubenosborne,项目名称:we03,代码行数:31,代码来源:resetpw.php

示例5: Comment

<?php

Auth::kickout('/pokecart/product/' . Route::param('id') . '/view');
$comment = new Comment();
$comment->content = Input::get('message');
$comment->product_id = Route::param('id');
$comment->user_id = Auth::user_id();
$comment->date_time = date('Y-m-d H:i:s');
$comment->save();
URL::redirect('/pokecart/product/' . Route::param('id') . '/view');
开发者ID:sean01,项目名称:pokecart,代码行数:10,代码来源:add_comment.php

示例6: Product

<?php

#1.
Auth::kickout_non_admin('/pokecart/');
$product = new Product();
$product->load(Route::param('id'));
$product->delete();
#2. REDIRECT
URL::redirect('/pokecart/admin');
开发者ID:sean01,项目名称:pokecart,代码行数:9,代码来源:delete_product.php

示例7: Project

<?php

# progress.php
# 1. Logic
$project = new Project();
$project->load(['slug' => Route::param('slug')]);
$task = new Task();
$task->load(Route::param('id'));
$task->progress = $task->progress + 1;
$task->save();
# 2.
URL::redirect('/' . $project->slug);
开发者ID:Wade-Nairn,项目名称:get-it-done-WE04,代码行数:12,代码来源:progress_task.php

示例8:

<?php

Cart::remove_product(Route::param('id'));
URL::redirect('/pokecart/cart');
开发者ID:sean01,项目名称:pokecart,代码行数:4,代码来源:cart_remove.php

示例9: Account

<?php

# controllers/paybill.php
# Logic
$account = new Account();
$account->load(['bill_id' => Route::param('id'), 'user_id' => Auth::user()->id]);
if ($account->id) {
    $account->paid = 1;
    $account->save();
}
# Redirect
URL::redirect('/');
开发者ID:reubenosborne,项目名称:we03,代码行数:12,代码来源:paybill.php

示例10: Bill

<?php

# controllers/deletebill.php
# Logic
Auth::kickout_non_admin('/');
$bill = new Bill();
$bill->load(Route::param('id'));
$bill->delete();
$accounts = new Accounts_Collection();
$accounts->where('bill_id', $bill->id);
$accounts->get();
foreach ($accounts->items as $account) {
    $account->delete();
}
# Redirect
URL::redirect('/admin');
开发者ID:reubenosborne,项目名称:we03,代码行数:16,代码来源:deletebill.php

示例11: Product

<?php

$product = new Product();
$product->load(Route::param('id'));
#1.
Cart::add_product(Route::param('id'), 1, $product->cart_max);
#2. LOAD VIEWS
if (AJAX) {
    echo json_encode(['success' => true, 'count' => Cart::get_total() + 1, 'name' => $product->name, 'image' => $product->image, 'id' => $product->id, 'price' => $product->price, 'sub' => Cart::get_subtotal() + $product->price, 'qty' => Cart::get_quantity($product->id)]);
} else {
    URL::redirect('/pokecart/cart');
}
开发者ID:sean01,项目名称:pokecart,代码行数:12,代码来源:cart_add.php

示例12: Product

<?php

$product = new Product();
$product->load(Route::param('id'));
Cart::set_quantity(Route::param('id'), Cart::get_quantity(Route::param('id')) - 1, $product->cart_max);
if (AJAX) {
    echo json_encode(['success' => true, 'count' => Cart::get_total() - 1, 'name' => $product->name, 'image' => $product->image, 'id' => $product->id, 'price' => $product->price, 'sub' => Cart::get_subtotal() - $product->price, 'qty' => Cart::get_quantity($product->id)]);
} else {
    URL::redirect('/pokecart/');
}
开发者ID:sean01,项目名称:pokecart,代码行数:10,代码来源:cart_remove_notification.php

示例13: Products_Collection

<?php

$products = new Products_Collection();
$products->where(['name LIKE' => '%' . Route::param('keywords') . '%', 'deleted' => '0']);
// $products->order_by('name', 'desc');
$products->get();
include VIEWS . 'header.php';
include VIEWS . 'products_grid.php';
include VIEWS . 'footer.php';
开发者ID:sean01,项目名称:pokecart,代码行数:9,代码来源:search.php

示例14:

						<li><a href="/pokecart/logout"><i class="fa fa-reply"></i>  Log out</a></li>

						
					<? else: ?>

						<li><a href="/pokecart/register"><i class="fa fa-user-plus"></i>  Register</a></li>
						<li><a href="/pokecart/login"><i class="fa fa-share"></i>  Login</a></li>

					<? endif ?>

					<li>
						<form class="navbar-form navbar-left" action="/pokecart/search.php">
							
							<div class="form-group">
								<input type="text" class="form-control" placeholder="Search" name="keywords" value="<?php 
echo Route::param('keywords');
?>
">
							</div>

							<button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
						</form>


					</li>
					<li>
						<div class="notification ">
							<div class="notification-cart hide animated">
								<h2 class="productName"></h2>
								<div class="flex flex-a-center flex-j-between">
									<a href="" class="productLink"><img src="" alt="" height="94" width="94" class="productImg"></a>
开发者ID:sean01,项目名称:pokecart,代码行数:31,代码来源:header.php


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