如何在php中分配属性?
我已经给 元素一个
data-filter
属性,如下所示:
<ul>
<li>
<a href="#" data-filter="*" class="all current"><?php _e('All', 'framework'); ?></a>
<span>/</span>
</li>
<?php
wp_list_categories(array(
'title_li' => '',
'taxonomy' =>
'skill-type',
'walker' => new Portfolio_Walker(),
'show_option_none' => ''
)
);
?>
</ul>
How can I pass this data-filter
property to PHP ?
I have given an <a>
element a data-filter
property, as shown:
<ul>
<li>
<a href="#" data-filter="*" class="all current"><?php _e('All', 'framework'); ?></a>
<span>/</span>
</li>
<?php
wp_list_categories(array(
'title_li' => '',
'taxonomy' =>
'skill-type',
'walker' => new Portfolio_Walker(),
'show_option_none' => ''
)
);
?>
</ul>
How can I pass this data-filter
property to PHP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能。不可能使用纯 HTML 和 PHP 将某个(虚构的)HTML 属性传输到 PHP。一个不错的选择是使用表单,您可以在其中选择单选按钮并提交表单。
编辑:
另一种选择是简单地通过请求的查询字符串传递过滤器:
You can't. It's not possible using pure HTML and PHP to transfer a certain (made-up) HTML attribute to PHP. A decent alternative is to use a form instead, where you could select a radio button and submit the form.
EDIT:
Another alternative is to simply pass the filter through the request's query string: