我正在尝试将此脚本https://github.com/briancray/PHP-URL-Shortener用于我自己的网站。在自述文件中,它在这里说明了这一点
要使用 PHP 以编程方式缩短 URL,请使用以下代码:
$shortenedurl = file_get_contents('http://yourdomain.com/shorten.php?longurl=' . urlencode('http://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['REQUEST_URI']));
如果我将此代码添加到我网站的任何页面,它应该缩短实际的站点链接。但它不会向我显示链接并缩短它。