Yourls - 某些自定义网址缩短了一些

时间:2015-02-12 21:00:43

标签: php yourls

我的某些网页提供了正确的缩短网址,但其中一些不会。即使他们在Yourls缩短了。我可以在管理员面板上看到它。

这是调整网址缩短

的网页
{"status":"fail","code":"error:url","url":{"keyword":"09266","url":"http:\/\/domain.com\/LilyPad-Arduino-328-Main-Board","title":"LilyPad Arduino 328 Main Board","date":"2015-02-12 00:35:39","ip":"xxx.xxx.xxx","clicks":"0"},"message":"http:\/\/domain.com\/LilyPad-Arduino-328-Main-Board already exists in database","title":"LilyPad Arduino 328 Main Board","shorturl":"http:\/\/doma.in\/09266","statusCode":200,"qrcimg":"http:\/\/doma.in\/user\/plugins\/inline-qrcode\/images\/qrccf6f0d99893974288d48676d9cdbd51a.png","qrimage":"

这是另一个页面的调试,没有网页上的网址但可在管理员处找到

{"status":"fail","code":"error:keyword","message":"Short URL 00027 already exists in database or is reserved","statusCode":200,"qrcimg":"http:\/\/doma.in\/user\/plugins\/inline-qrcode\/images\/qrcd41d8cd98f00b204e9800998ecf8427e.png","qrimage":"

这是我的PHP代码

function shortyourls(){
    global $smarty;

    // Inputs
    $shorturl   =   'http://' . $_SERVER['HTTP_HOST']  . $_SERVER['REQUEST_URI'];
    $signature  =   "123456789";
    $siteurl    =   "http://doma.in";
    $format     =   "json";
    $Artikel    =   $smarty->get_template_vars('Artikel');
    $title      =   http_build_query(array('title' => $Artikel->cName));
    $keyword    =   preg_replace("/[^0-9,.]/", "", ($Artikel->cArtNr));

    // Phases url
    $short = file_get_contents($siteurl.'/yourls-api.php?signature='.$signature.'&action=shorturl&url='.$shorturl.'&format='.$format.'&keyword='.$keyword.'&'.$title);

    $url=json_decode($short,TRUE);
    $output = $url['shorturl'];
    echo $output;
}

知道出了什么问题吗?

0 个答案:

没有答案