json_decode要求的字符串比较严格:
(1)使用UTF-8编码
(2)不能在最后元素有逗号
(3)不能使用单引号
(4)不能有\r,\t,如果有请替换

tp框架中的I函数默认对post的参数进行了htmlspecialchars过滤

'DEFAULT_FILTER'        =>  'htmlspecialchars', // 默认参数过滤方法 用于I函数...

string(23) "{"test":"url",'attr':1}"

string(43) "{"test":"url",'attr':1}"

json_decode是先进行htmlspecialchars_decode()处理

相关文章:

  • 2021-08-30
  • 2021-10-21
  • 2021-09-23
  • 2022-12-23
  • 2021-07-20
  • 2021-09-27
  • 2022-12-23
  • 2021-12-03
猜你喜欢
  • 2021-09-18
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案