【问题标题】:What does it mean when a html tag attribute include % in php?html标签属性在php中包含%是什么意思?
【发布时间】:2017-05-10 01:43:45
【问题描述】:
<?php
_e( '<input type="radio" name="%1$s" id="%2$s" value="yes" data-required="%1$s">', $support_input_name, $support_input_id );
    _e( '<label for="%1$s">%2$s</label>', $support_input_id, u('yes_text') );
?>

当我们将 %2 作为单选按钮的名称或 ID 时,这意味着什么? (这不是我的代码,但我需要对其进行一些修改。)我想获得所选单选按钮的结果;因此,我需要单选按钮的名称。

【问题讨论】:

  • 分享函数_e的代码

标签: javascript php html radio-button


【解决方案1】:

它们引用函数末尾的参数。

_e( '<input type="radio" name="%1$s" id="%2$s" value="yes" data-required="%1$s">', $support_input_name, $support_input_id );

%1$s 引用 $support_input_name 和 %2$s 引用 $support_input_id。只要这些值出现在字符串中,变量数据就会替换它们。

【讨论】:

  • 不知道_e函数下的源码怎么知道
猜你喜欢
  • 1970-01-01
  • 2016-01-31
  • 1970-01-01
  • 2011-01-20
  • 2018-12-27
  • 2011-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多