Home > php教程 > php手册 > body text

php中可能用来加密字符串的函数[base64_encode、urlencode、sha1

WBOY
Release: 2016-06-06 20:40:05
Original
1173 people have browsed it

做新浪微博自动登录时遇到的,身为一只大大的菜鸟,连登录脚本都是别人写好的自己改装了用上去,到最后才明白那个脚本原来是获取cookie用的,实在是反应迟钝、抑或自己不用心

登录原理还是蛮复杂的,像我这样以为curl获取页面再post上去的想法真是太单纯了。

整理下遇到的价格处理字符串的函数:

代码如下:
$encryption = "username";
echo base64_encode ($encryption);//echo "dXNlcm5hbWU= ";
echo "
";
echo urlencode("http://".$encryption);//echo " http%3A%2F%2Fusername ";
echo "
";
echo sha1($encryption);//echo "249ba36000029bbe97499c03db5a9001f6b734ec"
echo "
";
?>

记录它们的大概长相,以便日后遇到类的处理能够很快辨别出来。

顺便附上我当时找到脚本的文章地址:
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!