PHP的短URL函数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP的短URL函数相关的知识,希望对你有一定的参考价值。
Dear php coders,Here's a code block that you can use in your projects to get shorter long urls.
Also recommend these articles about [ozon tedavisi](http://www.denizliozon.com) here.
Have a nice coding.
<?php function shorturl($url){ if($length > 45){ $length = $length - 30; $new = $first."[ ... ]".$last; return $new; }else{ return $url; } } ?> // USAGE <?php $longurl= "http://www.google.com/search?q=symfony+project&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:tr:official&client=firefox-a"; $shorturl = shorturl($longurl); echo "<a href="$longurl">$shorturl</a>"; ?>
以上是关于PHP的短URL函数的主要内容,如果未能解决你的问题,请参考以下文章