本文整理汇总了PHP中URL::toRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::toRoute方法的具体用法?PHP URL::toRoute怎么用?PHP URL::toRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::toRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$person = CommandBusList::getPersonCommanBus()->handle(new GetCurrentPersonCommand());
$person->setStudioId(IsSetStudioSpecification::EMPTY_STUDIO_ID);
$this->getPersonCommandBus()->handle(new UpdatePersonCommand($person));
\Yii::$app->response->redirect(URL::toRoute('/cabinet/' . $person->user()->slug()));
}
示例2: run
public function run()
{
/**
* @var Person $person
*/
$person = CommandBusList::getPersonCommanBus()->handle(new GetCurrentPersonCommand());
if (IsSetStudioSpecification::withoutStudio($person)) {
\Yii::$app->response->redirect(URL::toRoute('/cabinet/' . $person->user()->slug()));
\Yii::$app->end();
}
$studioForm = new StudioForm();
if ($studioForm->load(\Yii::$app->request->post()) && $studioForm->validate()) {
$transaction = \Yii::$app->getDb()->beginTransaction();
try {
/**
* @var Studio $studio
*/
$studio = $this->getStudioCommandBus()->handle(new CreateStudioCommand($studioForm->name, $studioForm->phone, $studioForm->address));
$person->setStudioId($studio->id());
$this->getPersonCommandBus()->handle(new UpdatePersonCommand($person));
$transaction->commit();
\Yii::$app->response->redirect(URL::toRoute('/cabinet'));
} catch (Exception $e) {
$studioForm->addError('name', $e->getMessage());
}
$transaction->rollBack();
}
return $this->controller->render('studio', ['studioForm' => $studioForm]);
}
示例3: actionIndex
public function actionIndex()
{
switch (\Yii::$app->getUser()->identity->type) {
case UserType::USER_BRIDE:
\Yii::$app->response->redirect(URL::toRoute('bride/index'));
\Yii::$app->end();
break;
case UserType::USER_PHOTOGRAPGER:
\Yii::$app->response->redirect(URL::toRoute('photographer/index'));
\Yii::$app->end();
break;
default:
\Yii::$app->getUser()->logout();
\Yii::$app->response->redirect(URL::toRoute('/'));
\Yii::$app->end();
}
}
示例4: run
public function run($slug = false)
{
/**
* @var Person $person
*/
list($person, $slug) = $this->getPersonAndSlug($slug);
$result = false;
switch ($person->user()->type()->type()) {
case UserType::USER_PHOTOGRAPGER:
$result = (new photographer\IndexAction('index', $this->controller))->run($slug);
break;
case UserType::USER_BRIDE:
$result = (new bride\IndexAction('index', $this->controller))->run($slug);
break;
default:
\Yii::$app->getUser()->logout();
\Yii::$app->response->redirect(URL::toRoute('/auth'));
\Yii::$app->end();
}
return $result;
}
示例5: foreach
?>
<?php
foreach ($files as $file) {
?>
<img src="<?php
echo '/image/book/tmp/1/' . basename($file);
?>
" alt="" width="200"/>
<?php
}
?>
<?php
} else {
?>
<img data-url="<?php
echo URL::toRoute('book/file', true);
?>
" src="" alt="" width="200"/>
<?php
}
?>
</div>
<input type='file' id="upload-image" name="image" class="hide" accept=".jpg, .png, .jpeg">
<button id="image" type="button" class="btn btn-default">Upload Title Image</button>
</div>
<div class="col-lg-5">
</div>
</div>
<div class="form-group">
<div class="col-lg-12 text-right">
<button type="submit" class="btn btn-default">Submit</button>
示例6:
?>
</td>
<td><?php
echo Ref::getDesc('role', $user->role);
?>
</td>
<td align="center">
<a href="<?php
echo URL::toRoute('user/edit');
?>
&id=<?php
echo $user->user_id;
?>
" title="Kemaskini" data-rel="tooltip"><span class="fa fa-pencil-square-o bigger-130"/></a>
<a href="<?php
echo URL::toRoute('user/delete');
?>
&id=<?php
echo $user->user_id;
?>
" title="Hapus" data-rel="tooltip" class="askme"><span class="fa fa-trash-o bigger-130"/></a>
</td>
</tr>
<?php
}
?>
</table>
<?php
echo LinkPager::widget(['pagination' => $pages]);
?>
示例7: foreach
foreach ($refs as $r) {
?>
<tr>
<td><?php
echo $i++;
?>
.</td>
<td><?php
echo $r->code;
?>
</td>
<td><?php
echo $r->descr;
?>
</td>
<td align='center'>
<a href="<?php
echo URL::toRoute('ref/list');
?>
&kat=<?php
echo $r->code;
?>
" class="green" title="Senarai Kod" data-rel="tooltip"><i class="glyphicon glyphicon-search bigger-130"></i></a>
</td>
</tr>
<?php
}
?>
</table>
</div>
示例8: validateRegistrationStep
protected function validateRegistrationStep()
{
if (\Yii::$app->session->get('USER')->status == User::STATUS_REGISTERED) {
\yii::$app->user->login(\Yii::$app->session->get('USER'));
\Yii::$app->session->remove('USER');
\yii::$app->response->redirect(URL::toRoute('/userDetails'));
\Yii::$app->end();
}
}
示例9:
<a href="<?php
echo URL::toRoute('/product/view/' . $product->id);
?>
"><img src="<?php
echo Url::to('/images/products/' . $product->image);
?>
"/></a>
<p><?php
echo $product->description;
?>
</p>
<p class="product_price">$ <?php
echo $product->price;
?>
</p>
<a href="<?php
echo URL::toRoute('/cart/add/' . $product->id);
?>
" class="addtocart"></a>
<a href="<?php
echo URL::toRoute('/product/view/' . $product->id);
?>
" class="detail"></a>
</div>
<?php
}
} else {
?>
<p>Sorry, we don't have products</p>
<?php
}
示例10:
">
</div>
<div class="media-body">
<h4 class="media-heading">
<strong><?php
echo $ad->subject;
?>
</strong>
</h4>
<p><?php
echo Html::encode($ad->body);
?>
</p>
<div class="media-footer clearfix">
<a href="<?php
echo URL::toRoute(['user/profile/show', 'id' => $ad->user->id]);
?>
" class="author"><?php
echo Html::encode($ad->user->profile->name ? $ad->user->profile->name : $ad->user->username);
?>
</a>
<span class="time"><?php
echo Yii::$app->formatter->format($ad->created_at, 'relativeTime');
?>
</span>
</div>
</div>
</div>
<?php
}
?>
示例11:
* @var Person $groom
* @var Wedding $wedding
* @var boolean $isOwner
*/
echo $bride->user()->type()->name();
?>
<h3><?php
echo $bride->lastName();
?>
<?php
echo $bride->firstName();
?>
</h3>
<?php
if ($isOwner) {
echo HTML::a('Именить личные данные', [URL::toRoute('edit')], ['class' => 'btn btn-info pull-right']);
}
?>
<h4>Дата свадьбы</h4>
<?php
echo $wedding->date() ? \Yii::$app->formatter->asDate($wedding->date()) : 'пусто';
?>
<h4>Жених</h4>
<?php
echo $groom->lastName();
?>
<?php
echo $groom->firstName();
?>
<h4>О себе</h4>
<?php
示例12:
</div>
<div class="col-xs-4 text-center">
<a href="#">Sales</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Friends</a>
</div>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<a href="#" class="btn btn-default btn-flat">Profile</a>
</div>
<div class="pull-right">
<a href="<?php
echo URL::toRoute(['/site/logout']);
?>
" class="btn btn-default btn-flat">Sign out</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar" style="height: auto;">
示例13:
</tr>
<tr>
<td>Model:</td>
<td><?php
echo $product->title;
?>
</td>
</tr>
<tr>
<td>Manufacturer:</td>
<td>Apple</td>
</tr>
</table>
<div class="cleaner h20"></div>
<a href="<?php
echo URL::toRoute('/cart/add/' . $product->id);
?>
" class="addtocart"></a>
</div>
<div class="cleaner h30"></div>
<h5>Product Description</h5>
<p><?php
echo $product->description;
?>
</p>
<div class="cleaner h50"></div>
示例14:
use domain\service\entities\Service;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
/**
* @var Service[] $serviceList
* @var PersonService[] $personServiceList
* @var array $hoursArray
* @var bool $isSaved
*/
?>
<!-- price -->
<div class="col-xs-7">
<div class="alert alert-info">
<?php
$form = ActiveForm::begin(['action' => URL::toRoute('save-price'), 'options' => ['enctype' => 'multipart/form-data', 'method' => 'post', 'role' => 'form', 'class' => 'form-inline', 'data-pjax' => 1], 'id' => 'services']);
?>
<div class="container-fluid">
<?php
foreach ($serviceList as $service) {
?>
<div class="col-xs-4">
<label for="service[<?php
echo $service->id();
?>
]"><?php
echo $service->name();
?>
</label>
</div>
<div class="col-xs-2">
示例15:
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use app\models\Ref;
use yii\helpers\Url;
?>
<legend>Daftar Pengguna Baru</legend>
<div class="well col col-sm-10">
<?php
$form = ActiveForm::begin(['action' => URL::toRoute('cms/save')]);
?>
<input type="hidden" name="Cms[id]" value="<?php
echo $model->id;
?>
">
<div class="row">
<div class="col col-sm-2">Tajuk</div>
<div class="col col-sm-8"><?php
echo $form->field($model, 'title')->label(false);
?>
</div>
</div>
<div class="row">
<div class="col col-sm-2">Kandungan</div>
<div class="col col-sm-8"><?php
echo $form->field($model, 'content')->textarea(['rows' => 5])->label(false);
?>
</div>
</div>