我们说我有这样的数组:
Array (
[2066] => Array (
[images_id] => 2066
[title] => title one)
[2063] => Array (
[images_id] => 2063
[title] => title two )
[2022] => Array (
[images_id] => 2022
[title] => title three )
)
或以这样的数据库格式:
a:3:{i:2066;a:2:{s:8:"image_id";s:4:"2066";s:5:"title";s:9:"Title One";}i:2063;a:2:{s:8:"image_id";s:4:"2063";s:5:"title";s:9:"Title Two";}i:2022;a:2:{s:8:"image_id";s:4:"2022";s:5:"title";s:11:"Title Three";}}
如何使用 esc_attr 或 sanitize_text_field 清理 images_id 和标题?
任何帮助都非常感激:)
答案 0 :(得分:1)
您可以使用PHP的esc_attr()和sanitize_text_field()函数清理数组的this.props.data.results.map(this.renderArticles.bind(this))}
和images_id
字段3}}如下所示:
title