开发者

Extracting a certain section of a string

开发者 https://www.devze.com 2023-02-24 04:25 出处:网络
How do I get the value of tracking_id from a string similar to the string below: action_type=PAY&transaction_type=Adaptive+Payment+PAY&tracking_id=bovxedxgM开发者_开发百科&status=COMPLETE

How do I get the value of tracking_id from a string similar to the string below:

action_type=PAY&transaction_type=Adaptive+Payment+PAY&tracking_id=bovxedxgM开发者_开发百科&status=COMPLETED&

That is just a snipped of a much longer string.


Use parse_str():

parse_str('your-string-here', $data);
echo $data['tracking_id'];


$arguments = array();
parse_str('action_type=PAY&transaction_type=Adaptive+Payment+PAY&tracking_id=bovxedxgM&status=COMPLETED', $arguments);
$tracking_id = $arguments['tracking_id'];

http://php.net/parse-str

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号