dongyilu3143
2016-11-24 12:26
浏览 52
已采纳

如何将包含数组值的字符串转换为PHP数组?

I have a string that contains an array like:

$tarray = Array ( [gt_ref_id] => 36493115 [tender_notice_type] => [organisation_name] => ROSALES WATER DISTRICT [address] => No. 5 Bonifacio Street [address2] => [contact_person] => [tender_notice_no] => ROSALWD 2016-011-0144(Ref: 4206661)
)

but I want to access the value of this array like:

echo "ref id = ".$tarray['gt_ref_id'];

It should output like:

ref id = 36493115

but I can't because it's a string. I could if it was an array.

How can I convert the string to a proper PHP array?

2条回答 默认 最新

相关推荐 更多相似问题