问题描述
我正在存储这样的连接字符串:
I am storing a concatenated string like this:
echo json_encode($PostedDate.$Places.$Company.$Designation.$ProjectDetails.$DesiredCandidate.$HRName.$HRContact.$Email);
我可以使用JavaScript拆分此字符串并将值存储在数组中。但我想知道的是假设上面的任何值都是null,它会影响数组位置吗?
I can split this string using JavaScript and store values in an array. But what I want to know is that suppose any of the values above is null, will it affect the array position?
因为,我想保持数组位置固定。例如:
Because, I want to keep the array location fixed. For example:
myArray [0]必须持有$ PostedDate。
myArray[0] must hold $PostedDate.
如果$ PostedDate为null,那么,myArray [0]必须等于NULL。 $ Places不能占用myArray [0]的位置。
If $PostedDate is null, then also, myArray[0] must be equal to NULL. $Places must not take the position of myArray[0].
推荐答案
将字符串放到php数组中,如下所示:
put the strings onto a php array like so:
echo json_encode(array($ PostedDate,$ Places,$ Company));
echo json_encode(array($PostedDate,$Places,$Company));
这篇关于从json编码的字符串中检索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!