php代码
PHP 独特的语法混合了 C、Java、Perl 以及 PHP 自创新的语法。它可以比 CGI或者Perl更快速的执行动态网页。用PHP做出的动态页面与其他的编程语言相比,PHP是将程序嵌入到HTML文档中去执行,执行效率比完全生成HTML标记的CGI要高许多。下面介绍了十个PHP高级应用技巧。 1, 使用 ip2long() 和 long2ip() 函数来把 IP 地址转化成整型存储到数据库里
440
<?php
function code62($x) {
$show = '';
while($x > 0) {
$s = $x % 62;
if ($s > 35) {
$s = chr($s+61);
} elseif ($s > 9 && $s <=35) {
$s = chr($s + 55);
}
$show .= $s;
$x = floor($x/62);
}
return $show;
}
function shorturl($url) {
$url = crc32($url);
$result = sprintf("%u", $url);
//return $url;
//return $result;
return code62($result);
}
echo shorturl("此处为网址");
?>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号