【发布时间】:2013-07-22 09:39:54
【问题描述】:
我在 php 中找到了用于短链接的 bit.ly api,但我需要创建一个循环,其中将缩短链接数组...
所以,例如,我有数组:
Array
(
[0] => http://longlink.com/1.php
[1] => http://longlink.com/2.php
[2] => http://longlink.com/3.php
[3] => http://longlink.com/4.php
[4] => http://longlink.com/5.php
)
我需要将它缩短为这样的新数组:
Array
(
[0] => http://bit.ly/...
[1] => http://bit.ly/...
[2] => http://bit.ly/...
[3] => http://bit.ly/...
[4] => http://bit.ly/...
)
我已经包含了bitty api(HERE)和usnig php代码,我可以短一个链接
$bitly = new bitly('username', 'apikey');
echo $bitly->shorten('http://longlink.com/1.php');
但是你能告诉我,如何缩短那个数组吗?谢谢!
【问题讨论】:
-
srain 和 RP 是对的,没有缩短许多 API,因此您需要循环遍历长 URL。
标签: php arrays hyperlink short bit.ly