|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-11-24 22:15 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2014-11-24 22:15 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 06:00:01 2025 UTC |
Description: ------------ //Why the php5.4 does not require stripcslashes function, need and in PHP 5.2?? php 5.4 <?php header("Content-Type: application/json; charset=UTF-8"); header("Access-Control-Allow-Origin: *"); //获取请求参数 $req = $_REQUEST["req"]; //去掉反斜杠 //$req = stripcslashes ( $req ); $arr = json_decode ( $req, true ); print_r($arr); ?> php 5.2 php 5.4 <?php header("Content-Type: application/json; charset=UTF-8"); header("Access-Control-Allow-Origin: *"); //获取请求参数 $req = $_REQUEST["req"]; //去掉反斜杠 //$req = stripcslashes ( $req ); $arr = json_decode ( $req, true ); print_r($arr); ?> Test script: --------------- http://localhost:8080?req={"test":"?","loc":"{"province":"hanzhou"}"} php 5.4 <?php header("Content-Type: application/json; charset=UTF-8"); header("Access-Control-Allow-Origin: *"); //获取请求参数 $req = $_REQUEST["req"]; //去掉反斜杠 //$req = stripcslashes ( $req ); $arr = json_decode ( $req, true ); print_r($arr); ?> php 5.2 php 5.4 <?php header("Content-Type: application/json; charset=UTF-8"); header("Access-Control-Allow-Origin: *"); //获取请求参数 $req = $_REQUEST["req"]; //去掉反斜杠 //$req = stripcslashes ( $req ); $arr = json_decode ( $req, true ); print_r($arr); ?> Expected result: ---------------- return array Actual result: -------------- nothing return