本文整理汇总了PHP中yii\helpers\Url::To方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::To方法的具体用法?PHP Url::To怎么用?PHP Url::To使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Url
的用法示例。
在下文中一共展示了Url::To方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionDelete
public function actionDelete($id)
{
$id = intval($id);
if ($id <= 0) {
throw new HttpException(404, 'Указанный Вами товар не найден');
}
$good_current = Good::findOne($id);
if (!$good_current) {
throw new HttpException(404, 'Указанный Вами товар не найден');
}
$transaction = Good::getDb()->beginTransaction();
try {
$good_current->delete();
$transaction->commit();
return $this->redirect(Url::To(['category/cat', 'id' => $good_current->category_id]));
} catch (\Exception $ex) {
$transaction->rollBack();
throw $ex;
}
}
示例2: array
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\grid\ActionColumn;
/**
* @var yii\web\View $this
* @var yii\data\ActiveDataProvider $dataProvider
* @var app\modules\user\models\SearchUser $searchModel
*/
$this->title = 'Список страниц';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="">
<?php
echo GridView::widget(['id' => 'pages-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'options' => array('width' => '50px')], ['attribute' => 'title', 'format' => 'html', 'value' => function ($model) {
return Html::a($model['title'], ['update', 'id' => $model['id']]);
}], ['attribute' => 'alias', 'format' => 'url', 'value' => function ($model) {
return \yii\helpers\Url::To('@web/page/' . $model->alias, true);
}], ['attribute' => 'created_at', 'format' => ['date', 'dd.MM.yyyy'], 'options' => array('width' => '225px'), 'filter' => \yii\jui\DatePicker::widget(['dateFormat' => 'dd.MM.yyyy', 'model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
</div>
示例3:
echo $controller_title;
?>
</h1>
<?php
$output = ActiveForm::begin(['action' => Url::To(['category/save', 'id' => $id])]);
?>
<?php
echo $output->field($form, 'id')->hiddenInput(['value' => $id])->label('');
?>
<?php
echo $output->field($form, 'name')->textInput(['value' => !is_null($cat_current) ? htmlspecialchars_decode($cat_current->name) : '']);
?>
<?php
$mapper = ArrayHelper::map($categories, 'id', 'name');
$options = [$catalog_id => ['Selected' => 'selected']];
if ($id > 0) {
$options[$id] = ['Disabled' => 'disabled'];
}
echo $output->field($form, 'parent_id')->dropDownList($mapper, ['prompt' => 'Выберите родительский каталог', 'options' => $options]);
?>
<div class="form-group">
<?php
echo Html::submitButton('Сохранить', ['class' => 'btn btn-primary']);
?>
<a href="<?php
echo Url::To(['category/cat', 'id' => $catalog_id]);
?>
" class="btn btn-primary">Отменить</a>
</div>
<?php
ActiveForm::end();
示例4: actionIndex
public function actionIndex()
{
return $this->redirect(Url::To(['category/cat']));
}
示例5: foreach
}
?>
</p></li><br>
</ul>
<div class="delivery">
<p>Rp <?php
echo $value['shipping_price'];
?>
(Biaya Pengiriman) </p><br>
<p>Rp <?php
echo $value['shipping_price'] + $value['total_price'];
?>
(Total Biaya) </p>
<span><?php
if ($value['order_status_code'] < 1) {
echo '<a class="cpns" href="' . Url::To(['/front/front/confirm', "id" => $value['order_id']]) . '">confim pembayaran</a>';
} else {
echo '<a class="cpns" href="' . Yii::$app->urlManager->createUrl(['/front/front/print', "id" => $value['order_id']]) . '">invoice</a>';
}
?>
</span><br>
<?php
if ($value['order_status_code'] == 2) {
foreach ($model->findShippingOrder($value['order_id']) as $key => $shipping) {
if ($shipping['status_pengiriman'] = 0) {
echo '<p>Dalam Proses</p>';
} else {
if ($shipping['status_pengiriman'] = 1) {
echo '<p>Telah Dikirim</p><span>' . $shipping['tgl_pengiriman'] . '</span>';
} else {
echo '<p>Telah diterima</p><span>' . $shipping['tgl_diteri'] . '</span>';
示例6:
<a href="' . Url::To(['/front/front/detail-product', "id" => $value['Kode_Barang']]) . '"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>View</a>
</div>
</a>
</div>';
$i++;
}
?>
<div class="clearfix"></div>
</div>
</div>
</div>
<!---->
<div class="offers">
<div class="container">
<h3><a href="<?php
echo Url::To(['/front/front/product']);
?>
">Show More!!</a></h3>
</div>
</div>
<div class="subscribe">
<div class="container">
<h3>Autocom Inc - Best ......</h3>
</div>
</div>
<!---->
<!---->
示例7: Saya
<div class="col-md-9 cart-items">
<h1>Keranjang Belanja Saya (<?php
echo $user_session['jml_check_out'];
?>
)</h1>
<?php
if ($user_session['jml_check_out'] != 0) {
for ($i = 0; $i < $user_session['jml_check_out']; $i++) {
$model = new checkoutModel();
$value1 = $model->findProduct($user_session['check_out'][$i]);
foreach ($value1 as $key => $value) {
?>
<div class="cart-header">
<a href="<?php
echo Url::To(['/front/front/delete-item-chart', "i" => $i, "berat" => $value['Berat'], "harga" => $value['Harga_Satuan']]);
?>
"><div class="close1"> </div></a>
<div class="cart-sec simpleCart_shelfItem">
<div class="cart-item cyc">
<img src="/autocom<?php
echo $value['Gambar'];
?>
" class="img-responsive" alt=""/>
</div>
<div class="cart-item-info">
<h3><a href="single.html"><?php
echo $value['Nama_Barang'];
?>
</a></h3>
示例8:
$i = 1;
foreach ($productModel->findData() as $key => $value) {
if ($value['Stock_temp'] > 0 && $user_session['login']) {
$disabled = '';
} else {
$disabled = 'disabled="disabled"';
}
$form = ActiveForm::begin(['action' => Yii::$app->urlManager->createUrl('front/front/add-to-chart')]);
echo '
<a href="' . Url::To(['/front/front/detail-product', "id" => $value['Kode_Barang']]) . '"><div class="product-grid">
<div class="more-product"><span> </span></div>
<div class="product-img b-link-stripe b-animate-go thickbox">
<img src="/autocom' . $value['Gambar'] . '" class="img-responsive" alt="">
<div class="b-wrapper">
<h4 class="b-animate b-from-left b-delay03">
<button action="' . Url::To(['/front/front/detail-product', "id" => $value['Kode_Barang']]) . '"><span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span>Quick View</button>
</h4>
</div>
</div></a>
<div class="product-info simpleCart_shelfItem">
<div class="product-info-cust prt_name">
<h4>' . $value['Nama_Barang'] . '</h4>
<span class="item_price">Rp ' . $value['Harga_Satuan'] . '</span>
<div class="ofr">
<p class="pric1">Availibility Stock_temp</p>
<p class="disc">' . $value['Stock_temp'] . '</p>
</div>
<input type="hidden" name="addToChartModel[kode_barang]" class="item_add items" value="' . $value['Kode_Barang'] . '">
<input type="hidden" name="addToChartModel[berat]" class="item_add items" value="' . $value['Berat'] . '">
<input type="hidden" name="addToChartModel[stok]" class="item_add items" value="' . $value['Stock_temp'] . '">
示例9: actionDelete
public function actionDelete($id)
{
$id = intval($id);
if ($id <= 0) {
throw new HttpException(404, 'Указанный Вами каталог не найден');
}
$cat_current = Category::findOne($id);
if (!$cat_current) {
throw new HttpException(404, 'Указанный Вами каталог не найден');
}
$transaction = Category::getDb()->beginTransaction();
try {
$cat_current->delete();
Category::updateAll(['parent_id' => $cat_current->parent_id, 'depth' => $cat_current->depth], ['parent_id' => $cat_current->id]);
$transaction->commit();
return $this->redirect(Url::To(['category/cat', 'id' => $cat_current->parent_id]));
} catch (\Exception $ex) {
$transaction->rollBack();
throw $ex;
}
}