php - 如何通过 $_POST 获取动态变量
问题描述
我有类似的东西:
<fieldset>
{% if clientFriend %}
{% set cfInfo = clientFriend.info() %}
{% endif %}
<div class="form-group">
<label for="friendName" class="hidden"></label>
<input type="text" class="form-control" placeholder="FIO"
name="friend[{{ cfInfo.id }}][name]"
{% if cfInfo.friend_name %} value="{{ cfInfo.friend_name }}" {% endif %}>
</div>
<div class="form-group">
<label for="phoneFriend" class="hidden"></label>
<input type="tel" class="form-control" placeholder="Phone"
name="friend[{{ cfInfo.id }}][phone]"
{% if cfInfo.phone_friend %} value="{{ cfInfo.phone_friend }}" {% endif %}>
</div>
<div class="form-group">
<button class="btn btn-outline-blue btn-outline-blue-sm">
Add new
</button>
</div>
</fieldset>
我怎样才能得到这个动态变量$_POST
if ($_POST['friend[cfInfo.id][name]'])
不幸的是它不起作用。
解决方案
推荐阅读
- linkedin - 使用 LinkedIn API 更新个人资料标题/背景图像
- c++ - 是否可以使用 C 或 C++ 在文件系统上挂载共享内存段
- javascript - Create H1 element in div jQuery
- python - 数据框:pandas' isin 在一种情况下工作,但在另一种情况下显示错误
- php - 使用 PHP 和 MySQL 按品牌获取多个类别的产品总数
- javascript - Mapbox-gl – rendering static map based on bounds?
- python - 打印出 dask 系列/数据框的简单方法?
- html - Gatsby - 更改折叠初始 HTML
- c# - Unity Raycasting problem in some part of the scene
- windows - lua for windows read serial(RS-232) data