本文整理汇总了PHP中Url::toRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::toRoute方法的具体用法?PHP Url::toRoute怎么用?PHP Url::toRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::toRoute方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu dropdown-menu-default">
<li>
<a href="<?php
echo Url::toRoute('/admin/user/profile');
?>
">
<i class="icon-user"></i><?php
echo Module::t('user.info');
?>
</a>
</li>
<li>
<a href="<?php
echo Url::toRoute('/admin/default/logout');
?>
">
<i class="icon-key"></i><?php
echo Module::t('user.logout');
?>
</a>
</li>
</ul>
</li>
<!-- END USER LOGIN DROPDOWN -->
</ul>
</div>
<!-- END TOP NAVIGATION MENU -->
</div>
<!-- END HEADER INNER -->
示例2: beyondmenu
public static function beyondmenu($data, $plist, $mid)
{
$html = '';
foreach ($data as $k => $v) {
if (!empty($v['children'])) {
$fa = 'fa-list-alt';
$href = "javascript:;";
} else {
$fa = ' fa-chain';
$href = Url::toRoute([strtolower($v['controller']), 'mid' => $v['id']]);
}
$active = $open = '';
$html .= '<li id="beyondmenu' . $v['id'] . '" class="">
<a href="' . $href . '" class="menu-dropdown">
<i class="menu-icon fa ' . $fa . '"></i>
<span class="menu-text" alt="' . $v['title'] . '" title="' . $v['title'] . '">
' . StringHelper::truncate($v['title'], 6) . '
</span>';
if (!empty($v['children'])) {
$html .= '<i class="menu-expand"></i>';
}
$html .= '</a>';
if (!empty($v['children'])) {
$html .= '<ul class="submenu">';
$html .= self::beyondmenu($v['children'], $plist, $mid);
$html .= '</ul>';
}
$html .= '</li>';
}
return $html;
}
示例3: actionDelete
/**
* Deletes an existing Rrhh model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$desactiv = $this->findActiv($id);
$desactiv->activate = 0;
if ($desactiv->update() !== false) {
return $this->redirect(['index']);
} else {
echo "Ha ocurrido un error al realizar el registro, redireccionando ...";
echo "<meta http-equiv='refresh' content='8; " . Url::toRoute("rrhh") . "'>";
}
}
示例4: more
show(jmore);
show1(jmore);
}
var arr = [];
for(var i=0;i</*items.length*/Math.min(items.length, 4);i++){
arr.push(template(xml2obj(items[i])));
}
startnum = 0;
var html = arr.join('');
var newNode = document.createElement("div");
newNode.innerHTML =html;
jlist.insertBefore(newNode,null);
}else{
if(pagenum==1){
window.location.href = '<?php
echo Url::toRoute(['site/index', 'refresh' => true]);
?>
';
var html = '<h4 class="zj-tit"><span>该公众号暂未发布文章</span></h4>';
var newNode = document.createElement("div");
newNode.innerHTML =html;
jlist.insertBefore(newNode,null);
show(jbox);
}
}
}
function more(){
hide1(jmore);
pagenum ++;
ajaj(url+pagenum);
}
示例5: actionConfirm
public function actionConfirm()
{
$table = new Users();
if (Yii::$app->request->get()) {
//Obtenemos el valor de los parámetros get
$id = Html::encode($_GET["id"]);
$authKey = $_GET["authKey"];
if ((int) $id) {
//Realizamos la consulta para obtener el registro
$model = $table->find()->where("id=:id", [":id" => $id])->andWhere("authKey=:authKey", [":authKey" => $authKey]);
//Si el registro existe
if ($model->count() == 1) {
$activar = Users::findOne($id);
$activar->activate = 1;
if ($activar->update()) {
echo "Enhorabuena registro llevado a cabo correctamente, redireccionando ...";
echo "<meta http-equiv='refresh' content='8; " . Url::toRoute("site/login") . "'>";
} else {
echo "Ha ocurrido un error al realizar el registro, redireccionando ...";
echo "<meta http-equiv='refresh' content='8; " . Url::toRoute("site/login") . "'>";
}
} else {
return $this->redirect(["site/login"]);
}
} else {
return $this->redirect(["site/login"]);
}
}
}
示例6:
<?php
$form = ActiveForm::begin(['options' => ['id' => 'profile-form', 'enableAjaxValidation' => true]]);
?>
<?php
// echo $form->field($model, 'profile_image')->widget(FileAPI::className(), [
// 'settings' => [
// 'url' => ['admin/fileapi-upload'],
// 'autoUpload' => true,
// ],
// 'crop' => true,
// 'cropResizeWidth' => 200,
// 'cropResizeHeight' => 200
// ]);
echo $form->field($model, 'profile_image')->widget(NewWidget::className(), ['uploadUrl' => Url::toRoute(['/user/user-profile/uploadphoto']), 'previewUrl' => $model->module->ImagePathPreview, 'tempPreviewUrl' => $model->module->ImageTempPathPreview, 'width' => 200, 'height' => 200]);
?>
<?php
echo $form->field($model, 'id')->textInput(['readonly' => true]);
?>
<?php
echo $form->field($model, 'first_name')->textInput(['maxlength' => 40]);
?>
<?php
echo $form->field($model, 'last_name')->textInput(['maxlength' => 40]);
?>
<?php
示例7: actionTasknotecreate
/**
* Creates a new TaskNote model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionTasknotecreate($projectid, $taskid)
{
$model = new TaskNote();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(Url::toRoute(['tasknoteview', 'projectid' => $projectid, 'taskid' => $taskid, 'id' => $model->id]));
} else {
$model->taskID = $taskid;
return $this->render('tasknotecreate', ['model' => $model]);
}
}
示例8: array_push
<?php
use yii\helpers\url;
use yii\web\Session;
$menu = ['options' => ['class' => 'nav-pills'], 'items' => [['label' => 'Home', 'url' => Url::toRoute([' '])], ['label' => 'Projects', 'items' => [['label' => 'Project List', 'url' => Url::toRoute(['project/projectlist'])], '<li class="divider"></li>', ['label' => 'New Project', 'url' => Url::toRoute(['project/create'])]]]]];
if (isset(\Yii::$app->session['ProjectID'])) {
array_push($menu['items'], ['label' => 'Tasks', 'items' => [['label' => 'Task List', 'url' => Url::toRoute(['project/tasklist', 'projectid' => \Yii::$app->session['ProjectID']])], '<li class="divider"></li>', ['label' => 'New Task', 'url' => Url::toRoute(['project/task-create'])], ['label' => 'TaskComments', 'url' => ['task-comment/index']]]]);
array_push($menu['items'], ['label' => 'SRI', 'items' => [['label' => 'Task Statuses', 'url' => ['task-status/index']]]]);
}
return $menu;
示例9: foreach
</div>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong>Related</strong> Questions</div>
<?php
if (count($related) > 0) {
?>
<div class="list-group">
<?php
foreach ($related as $question) {
?>
<a class="list-group-item" href="<?php
echo Url::toRoute(['question/view', 'id' => $question['id']]);
?>
"><?php
echo Html::encode($question['post_title']);
?>
</a>
<?php
}
?>
</div>
<br>
<?php
} else {
?>
<div class="panel-body"><p>No related questions</p></div>
<?php
示例10: actionDebug
public function actionDebug($id = '', $session = '')
{
$userid = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
if (!in_array($userid, [386])) {
return false;
}
/*
单设备上传文件统计
数据库文件同步情况统计
临时列表文件与FTP对比统计
*/
$line = 1000;
$show = $js_script = '';
$logPath = Yii::$app->getRuntimePath();
if ($session) {
$show .= 'SESSION [' . $session . ']:<br />';
$result = \app\models\device\DeviceLog::find()->select('type,created_at,gps,file,efile,ffile')->where(['session' => $session])->orderBy('id desc')->all();
foreach ($result as $k) {
if (isset($k->attributes)) {
$show .= '<font color="red">' . date('Y-m-d H:i:s', $k->created_at) . '</font>';
$show .= '[' . $k->type . ']' . $k->ftp . '(' . $k->gps . ')efile:' . $k->efile . ',ffile:' . $k->ffile;
// $show.=var_export($k->attributes,true);
// $show.='<hr />';
$show .= '<br />';
}
}
return $this->render('debug', ['show' => $show, 'device_sn' => $id, 'menus' => ['realinfo', 'console', 'app', 'device_connect']]);
}
$id = $id ? $id : 'realinfo';
switch ($id) {
case 'console':
case 'app':
case 'device_connect':
$show .= '<p style="color:blue;">' . $logPath . '/' . $id . '.log last ' . $line . 'lines:</p><br>';
$show .= nl2br($this->FileLastLines($logPath . '/logs/' . $id . '.log', $line));
break;
case 'realinfo':
// new Device 两天内增加的新设备统计
$time = strtotime('-1 day');
$result = \app\models\device\Device::find()->where(['>', 'register_at', $time])->limit(300)->all();
$c = count($result);
$show .= '<b>Two days to increase the new Device(' . $c . ')</b>:<br />';
foreach ($result as $k) {
if (isset($k->attributes)) {
$show .= '[' . date('Y-m-d H:i:s', $k->register_at) . ']<a href="' . Url::toRoute(["site/debug", 'id' => $k->device_sn]) . '" target="_blank">' . $k->device_sn . '</a> ';
$show .= 'ftp_ip:' . $k->ftp_ip . ',server_ip:' . $k->server_ip . '<br />';
}
}
//Redis Online Device
$result = \app\models\device\redis\Device::find()->where(['status' => 1])->all();
$c = count($result);
$show .= '<b>Redis Online Device(' . $c . ')</b>:<a target="_blank" href="' . Url::toRoute(["site/trunoff"]) . '">D</a> <br />';
foreach ($result as $k) {
if (isset($k->attributes)) {
// $show.='<a target="_blank" href="'.Url::toRoute(["site/trunoff"]).'&device_sn='.$k->device_sn.'">D</a>';
$show .= '<a href="' . Url::toRoute(["site/debug", 'id' => $k->device_sn]) . '">' . $k->device_sn . '</a> ';
$show .= 'id:' . $k->id . ',ftp_ip:' . $k->ftp_ip . ',latitude:' . $k->latitude . ',longitude:' . $k->longitude . '<br />';
//.',server_ip:'.$k->server_ip
}
}
//Last RealInfo
$result = \app\models\device\RealInfo::find()->orderBy('id desc')->select('id,device_sn,session_id,latitude,longitude,uploadpercentage,ffile,efile,created_at')->limit($c * 2)->all();
$show .= '<b>Last RealInfo(' . count($result) . ')</b>:<br />';
foreach ($result as $k) {
if (isset($k->attributes)) {
$show .= '<a href="' . Url::toRoute(["site/debug", 'session' => $k->session_id]) . '">' . $k->session_id . '</a> - <a href="' . Url::toRoute(["site/debug", 'id' => $k->device_sn]) . '">' . $k->device_sn . '</a>' . date('Y-m-d H:i:s', $k->created_at) . ',[' . $k->latitude . ',' . $k->longitude . '],' . $k->ffile . '(' . $k->uploadpercentage . ')<br />';
}
}
//Last UploadVideo
$result = \app\models\device\RealInfo::find()->where(['>', 'uploadpercentage', 0])->orderBy('id desc')->select('id,device_sn,session_id,latitude,longitude,uploadpercentage,ffile,efile,created_at')->limit(10)->all();
$show .= '<b>Last UploadVideo(' . count($result) . ')</b>:<br />';
foreach ($result as $k) {
if (isset($k->attributes)) {
$show .= '<a href="' . Url::toRoute(["site/debug", 'id' => $k->device_sn]) . '">' . $k->device_sn . '</a>' . date('Y-m-d H:i:s', $k->created_at) . ',[' . $k->latitude . ',' . $k->longitude . '],' . $k->ffile . '(' . $k->uploadpercentage . ')<br />';
//'.$k->session_id.'
}
}
break;
default:
$device_sn = $id;
$show .= $device_sn . ' Redis Device:<br />';
$result = \app\models\device\redis\Device::find()->where(['device_sn' => $device_sn])->all();
foreach ($result as $k) {
if (isset($k->attributes)) {
$show .= '当前<font color="red">' . ($k->status ? '在线' : '不在线') . '</font><br />';
$show .= '上次登录:' . date('Y-m-d H:i:s', $k->login_at) . '<br />';
$show .= '<font color="red">Redis Device:' . $k->id . '</font><br />';
$show .= var_export($k->attributes, true);
$show .= '<hr />';
}
}
$show .= $device_sn . ' Redis RealInfo:<br />';
$result = \app\models\device\redis\RealInfo::find()->where(['device_sn' => $device_sn])->all();
foreach ($result as $k) {
if (isset($k->attributes)) {
$show .= '<font color="red">Redis RealInfo:' . $k->id . '</font><br />';
$show .= var_export($k->attributes, true);
$show .= '<hr />';
}
}
//.........这里部分代码省略.........
示例11:
<?php
/* @var $this yii\web\View */
?>
<h1>发布您的代言</h1>
<p>
<form method="post" action="<?php
echo Url::toRoute(['product/create']);
?>
" >
<TABLE>
<TR>
<TD>产品类型</TD>
<TD>
<select name="product[type]">
<?php
foreach ($type as $val) {
?>
<option value="<?php
echo $val['id'];
?>
"><?php
echo $val['name'];
?>
</option>
<?php
}
?>
示例12:
<a href="javascript:void(0);" class="container-fluid bt-menu">Menu<span class="glyphicon glyphicon-tasks"></span></a>
</div>
</header>
<aside class="col-xs-12 col-sm-3 col-md-2 menu">
<ul class="container-fluid">
<li class="row submenu"><a href="javascript:void(0);"><span class="glyphicon glyphicon-calendar"></span>Eventos<span class="glyphicon glyphicon-menu-down"></span></a>
<ul class="children">
<li><a href=""><span class="glyphicon glyphicon-plus"></span>Alta</a></li>
<li><a href=""><span class="glyphicon glyphicon-ok"></span>Modificar</a></li>
<li><a href=""><span class="glyphicon glyphicon-remove"></span>Eliminar</a></li>
</ul>
</li>
<li class="row"><a href=""><span class="glyphicon glyphicon-user"></span>Profesores</a></li>
<li class="row"><a href=""><span class="glyphicon glyphicon-search"></span>Busqueda</a></li>
<li class="row"><a href="<?php
echo Url::toRoute("usuario/logout");
?>
" data-method="post"><span class="glyphicon glyphicon-off"></span>Cerrar Sesion</a></li>
</ul>
</aside>
<?php
echo $content;
?>
</div>
</div>
<?php
$this->endBody();
?>
</body>
</html>
<?php
示例13: actionCreate
/**
* Creates a new User model.
* If creation is successful, the browser will be redirected to the 'view' endpoint.
* @return mixed
*/
public function actionCreate()
{
$model = \Yii::createObject(User::className());
$model->scenario = 'create';
$model->load(\Yii::$app->request->bodyParams, '');
if ($model->save()) {
\Yii::$app->response->setStatusCode(201);
\Yii::$app->response->headers->set('Location', Url::toRoute(['view', 'id' => $model->id], true));
} elseif (!$model->hasErrors()) {
throw new ServerErrorHttpException('Failed to create the object for unknown reason.');
}
return $model;
}