2017-05-12 6 views
0

私のURLはyii2にあります:YII2のUrlメソッドを変更する

$ component_id = '175'; $ used = '1';

Yii::$app->UrlManager->createUrl('component/datafield&c_id='.$component_id.'&value='.$used); 

そのラン:

index.php?r=component%2Fdatafield%26c_id%3D176%26value%3D1 

そのページが見つかりませんを示しています - ((((

答えて

1

これはYii2ガイド(http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#routing-and-url-creation)の例である:

use yii\helpers\Url; 

// Url::to() calls UrlManager::createUrl() to create a URL 
$url = Url::to(['post/view', 'id' => 100]); 

アクション "actionDataField"を持つ "ComponentController"があるとします:

$url = Url::to(['component/datafield','c_id'=>$component_id,'value'=>$used]); 
+0

素晴らしい作品です:-)))))非常にありがとう... – Prabhakaran

関連する問題