我有一个名为$val
的数组。这是一个空白数组。我希望以下面的方式,即在print_r($val);
之后它应该按照以下方式打印数组$val
:
我也关注变量:
$_POST['fileName'] = 'Sample_1.docx';
$_POST['fileLink'] = 'https://www.filepicker.io/api/file/HEYQ6lPNRg2lzjUNhUGX';
Array
(
[status_info] =>
[user_status] => Share what's going on...
[group_id] =>
[action] => upload_photo_via_share
[is_activity_feed] => 1
[vshare] => Array
(
[Sample_1.docx] => Array
(
[0] => https://www.filepicker.io/api/file/HEYQ6lPNRg2lzjUNhUGX
)
)
[link] => Array
(
[url] => http://
)
[poll_question] =>
[answer] => Array
(
[0] => Array
(
[answer] =>
)
[1] => Array
(
[answer] =>
)
)
[is_profile] => no
[iframe] => 1
[method] => simple
[document_title] => document
[category] => Array
(
[0] =>
)
[code_snippet] =>
)
我想在变量$val
中添加以下结构。这件事应该只使用PHP代码完成。
如何在PHP中向数组$val
添加以下键值结构?
提前致谢。
答案 0 :(得分:0)
此数组的PHP源代码应如下所示:
$val = array(
'status_info' => '',
'user_status' => 'Share what's going on...',
...
'vshare' => array(
'Sample_1.docx' => array (
'https://www.filepicker.io/api/file/HEYQ6lPNRg2lzjUNhUGX'
)
),
'link' => array(
'url' => 'http://'
),
...
);