html控制器,HTML按钮呼叫控制器/行动(HTML Button calling controller/acti

我想创建按钮Yii中的HTML按钮,点击我要调用一个UserController.php和Actioncreate。

我做这样的,

echo CHtml::button('Signup', array('button' => array('Users/create'))); ?>

但它给我下面的错误

htmlspecialchars() expects parameter 1 to be string, array given

这是堆栈跟踪

D:\wamp\www\yii\framework\web\helpers\CHtml.php(85)

73 */

74 public static $liveEvents = true;

75

76 /**

77 * Encodes special characters into HTML entities.

78 * The {@link CApplication::charset application charset} will be used for encoding.

79 * @param string $text data to be encoded

80 * @return string the encoded data

81 * @see http://www.php.net/manual/en/function.htmlspecialchars.php

82 */

83 public static function encode($text)

84 {

85 return htmlspecialchars($text,ENT_QUOTES,Yii::app()->charset);

86 }

87

88 /**

89 * Decodes special HTML entities back to the corresponding characters.

90 * This is the opposite of {@link encode()}.

91 * @param string $text data to be decoded

92 * @return string the decoded data

93 * @see http://www.php.net/manual/en/function.htmlspecialchars-decode.php

94 * @since 1.1.8

95 */

96 public static function decode($text)

97 {

Stack Trace

#0

+

D:\wamp\www\yii\framework\web\helpers\CHtml.php(85): htmlspecialchars(array("Users/create"), 3, "UTF-8")

#1

+

D:\wamp\www\yii\framework\web\helpers\CHtml.php(2216): CHtml::encode(array("Users/create"))

#2

+

D:\wamp\www\yii\framework\web\helpers\CHtml.php(140): CHtml::renderAttributes(array("button" => array("Users/create"), "name" => "yt1", "type" => "button", "value" => "Signup"))

#3

+

D:\wamp\www\yii\framework\web\helpers\CHtml.php(436): CHtml::tag("input", array("button" => array("Users/create"), "name" => "yt1", "type" => "button", "value" => "Signup"))

#4

D:\wamp\www\nurseweb\protected\views\site\login.php(50): CHtml::button("Signup", array("button" => array("Users/create")))

45 <?php echo $form->error($model,'rememberMe'); ?>

46

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值