【问题标题】:How to impliment links in yii 1?如何在 yii 1 中实现链接?
【发布时间】:2016-11-04 15:47:55
【问题描述】:

我有以下代码:

    return array(
        ULogt::UPDATE => '

 <div>     
    <a href="#link">Navigate</a>
 </div>
'

此代码位于名为 links.php 的类中。 当用户按下导航按钮时,我需要导航到('viewform', array('model'=&gt;$this-&gt;loadJson($id))。我不知道如何插入此代码而不是 #link。我该怎么做?

【问题讨论】:

    标签: php yii yii1.x


    【解决方案1】:
    CHtml::link( 
       "Navigate", 
       "javascript:void(0);", // link for destination or you can handle same with jQuery
       array(
        'id' => 'navigation-id', // id for handeling in jQuery
        'key' => $data, // Required data will be appeared as attributes for this link
       )
    );
    

    你可以像这样创建链接

    Yii::app()->createUrl(
             '/profile/membership/view', // your link
             array(
                 'id'=> 1  // data to be sent
             )
     )
    

    Check for URL formating

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-22
      • 1970-01-01
      • 2021-06-14
      • 2020-12-01
      • 2012-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多