gpt4 book ai didi

php - 逗号分隔的字符串作为 url 数组

转载 作者:行者123 更新时间:2023-11-29 07:30:47 25 4
gpt4 key购买 nike

<分区>

我需要在 mysql 表中存储一个逗号分隔的字符串(url 数组)。

例如:

"https://google.com,https://yahoo.com,https://something.com"

从 php 中的表中获取它我正在使用 explode 函数来获取数组。

$arr = explode(',', $string);

问题是因为一些 url 本身可以包含逗号字符,这会产生混淆。

事实上,url 可以包含任何字符,转义与否 - 它会在 explode 函数中产生错误。

有什么帮助吗?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com