我有以下数组,我想检索name,comment和each of the tags(在数据库中插入.如何检索数组值.另外,我只能过滤大于3个字符的标签值,并且只包含一个-Z0-9值.非常感谢你.
Array
(
[folder] => /test
[name] => ajay
[comment] => hello world.. test comment
[item] => Array
(
[tags] => Array
(
[0] => javascript
[1] => coldfusion
)
)
)
Run Code Online (Sandbox Code Playgroud)
$name = $array['name'];
$comment = $array['comment'];
$tags = $array['item']['tags']; // this will be an array of the tags
Run Code Online (Sandbox Code Playgroud)
然后,您可以遍历标记,如:
foreach ($tags as $tag) {
// do something with tag
}
Run Code Online (Sandbox Code Playgroud)
或单独访问每一个
echo $tags[0];
echo $tags[1];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31288 次 |
| 最近记录: |