字符串数组的PHP-json解码

字符串数组的PHP-json解码,php,json,Php,Json,我使用此代码进行编码: $cont = json_encode(array_chunk($arr_content, 1, true)); 我的var_dump($cont)的编码数据是: 我的网址是: http://localhost/Nayve/search.php?content=[[%22nothing%22],{%221%22:%22Synonyms%20for%20%3Cb%3Egood%3C\/b%3E%20at%20Thesaurus.com%20with%20free%20on

我使用此代码进行编码:

$cont = json_encode(array_chunk($arr_content, 1, true));
我的var_dump($cont)的编码数据是:

我的网址是:

http://localhost/Nayve/search.php?content=[[%22nothing%22],{%221%22:%22Synonyms%20for%20%3Cb%3Egood%3C\/b%3E%20at%20Thesaurus.com%20with%20free%20online%20thesaurus,%20antonyms,%20and%20\ndefinitions.%20Dictionary%20and%20Word%20of%20the%20Day.%22},{%222%22:%22A%20magazine%20for%20the%20global%20citizen%20covering%20stories%20from%20business,%20environment,%20\npolitics,%20art,%20design,%20culture,%20technology,%20education,%20urban%20issues%20and%20the%20latest\u00a0...%22},{%223%22:%22It%20is%20%3Cb%3Egood%3C\/b%3E%20that%20you%20are%20here.%20His%20credentials%20are%20%3Cb%3Egood%3C\/b%3E.%205.%20well-behaved:%20a%20%3Cb%3Egood%3C\/b%3E%20\nchild.%206.%20kind,%20beneficent,%20or%20friendly:%20to%20do%20a%20%3Cb%3Egood%3C\/b%3E%20deed.%207.%20honorable%20or%20worthy;%20in\n\u00a0...%22},{%224%22:%22The%20secure%20mobility%20solution%20that%20unlocks%20your%20mobile%20potential.%22},{%225%22:%22The%20latest%20Tweets%20from%20%3Cb%3EGOOD%3C\/b%3E%20(@%3Cb%3Egood%3C\/b%3E).%20A%20magazine%20for%20the%20global%20citizen.%20Los%20\nAngeles,%20CA.%22},{%226%22:%22of%20high%20quality.%20:%20of%20somewhat%20high%20but%20not%20excellent%20quality.%20:%20correct%20or%20proper.%2048%20\nwords%20to%20make%20in%20SCRABBLE%20with%20Q%20and%20no%20U%20\u00bb.%20bet\u00b7ter%20\\\u02c8be-t\u0259r\\%20best%20\\\u02c8best\\\u00a0...%22},{%227%22:%22From%20Middle%20English%20%3Cb%3Egood%3C\/b%3E,%20from%20Old%20English%20g\u014dd%20%20%20(\u201c%3Cb%3Egood%3C\/b%3E,%20virtuous,%20desirable,%20\nfavorable,%20salutary,%20pleasant,%20valid,%20efficient,%20suitable,%20considerable,%20sufficiently\u00a0...%22},{%228%22:%22%3Cb%3EGOOD%3C\/b%3E.%20364873%20likes%20\u00b7%2019190%20talking%20about%20this.%20%3Cb%3EGOOD%3C\/b%3E%20is%20a%20place%20to%20share%20\ncreative%20solutions%20for%20living%20well%20and%20doing%20%3Cb%3Egood%3C\/b%3E.%22},{%229%22:%22Lets%20users%20track%20and%20rate%20books%20and%20network%20with%20other%20readers.%22},{%2210%22:%22The%20rise%20of%20national%20socialism%20in%20Germany%20should%20not%20be%20regarded%20as%20a%20\nconspiracy%20of%20madmen.%20Millions%20of%20&quot;%3Cb%3Egood%3C\/b%3E&quot;%20people%20found%20themselves%20in%20a%20society%20\nspiralling\u00a0...%22},{%2211%22:%22We%20are%20%3Cb%3EGOOD&#39;s<\/b> social innovation consultancy. We work with organizations to \nimagine bold leadership opportunities that align metrics with social impact."},{"12":"<b>Good<\/b> may refer to: ... This disambiguation page lists articles associated with the \ntitle <b>Good<\/b>. If an internal link led you here, you may wish to change the link to\u00a0..."},{"13":"<b>Good<\/b> articles are considered to be of <b>good<\/b> quality, but are not yet as qualified as \nfeatured articles. <b>Good<\/b> articles meet the <b>good<\/b> article criteria, passing through\u00a0..."},{"14":"We are Rhett &amp; Link and this is our daily morning talk show, <b>Good<\/b> Mythical \nMorning. Check out our main channel for funny music videos, sketches, and \nridiculo..."},{"15":"Log in to your Network for <b>Good<\/b> account to access donation history, product \nconfiguration, and more."},{"16":"<b>Good<\/b> Sam Club \u2013 RV Club camping memberships, services, RV Park and \ncampground discounts, online travel resources, members only Camping World \noffers,\u00a0..."}]
我想,在生成内容时使用urlencode(),然后在接收内容时使用urldecode可能会有所帮助

$cont = urlencode(json_encode(array_chunk($arr_content, 1, true)));

<?php 
if ($_GET['content']!=null ) {
  $array5=urldecode($_GET['content']);
  $contents=json_decode($array5);
  var_dump($contents);

}?>
$cont=urlencode(json_encode(数组块($arr_content,1,true));
我想在生成内容时使用urlencode(),然后在接收内容时使用urldecode可能会有所帮助

$cont = urlencode(json_encode(array_chunk($arr_content, 1, true)));

<?php 
if ($_GET['content']!=null ) {
  $array5=urldecode($_GET['content']);
  $contents=json_decode($array5);
  var_dump($contents);

}?>
$cont=urlencode(json_encode(数组块($arr_content,1,true));

在我看来,在查询字符串中存储那么多数据不是一个好主意。您可以改用会话变量:

# Encoding file

session_start();
$_SESSION['temp_content'] = json_encode(array_chunk($arr_content, 1, true));
header("Location: search.php");

# Receiving file

session_start();
if (!empty($_SESSION['temp_content'])) {
    $contents = json_decode($_SESSION['temp_content']);
    var_dump($contents);
    unset($_SESSION['temp_content']);
}

在我看来,在查询字符串中存储那么多数据不是一个好主意。您可以改用会话变量:

# Encoding file

session_start();
$_SESSION['temp_content'] = json_encode(array_chunk($arr_content, 1, true));
header("Location: search.php");

# Receiving file

session_start();
if (!empty($_SESSION['temp_content'])) {
    $contents = json_decode($_SESSION['temp_content']);
    var_dump($contents);
    unset($_SESSION['temp_content']);
}

你能粘贴你的数组块的变量转储吗($arr_content,1,true)我在我的主题字符串(2670)“[[”“]”,{“1”:“Thesaurus.com的同义词,以及免费的在线同义词、反义词和定义。字典和当天的单词。”},{“2”:”一本面向全球公民的杂志,涵盖商业、环境、政治、艺术、设计、文化、技术、教育、城市问题以及最新的信息,{“3”:你在这里真好。他的证书很好。5.行为端正:善良的孩子。6.善良、仁慈或友好:做好事。7.尊敬的或有价值的;在\n\u00a0…},{“4”:“安全移动”可以粘贴数组块的变量转储($arr\u content,1,true)我在我的主题字符串(2670)[[“”],{“1”:Thesaurus.com上的good同义词,有免费的在线同义词、反义词和定义。字典和每日词汇。{“2”:“一本面向全球公民的杂志,涵盖了商业、环境、政治、艺术、设计、文化、技术、教育、城市问题和最新信息……”,{“3”:”你在这里真好。他的资历很好。5.品行端正:善良的孩子。6.善良、仁慈或友好:做一件好事。7.尊敬的或有价值的;在
$cont = urlencode(json_encode(array_chunk($arr_content, 1, true)));

<?php 
if ($_GET['content']!=null ) {
  $array5=urldecode($_GET['content']);
  $contents=json_decode($array5);
  var_dump($contents);

}?>
# Encoding file

session_start();
$_SESSION['temp_content'] = json_encode(array_chunk($arr_content, 1, true));
header("Location: search.php");

# Receiving file

session_start();
if (!empty($_SESSION['temp_content'])) {
    $contents = json_decode($_SESSION['temp_content']);
    var_dump($contents);
    unset($_SESSION['temp_content']);
}