宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应
您当前的位置: > 博客2 > AS2与AS3技术

[AS3]as3加密算法遇到php字符转码与as3的解码

2016-10-13 00:16:48 点击量:16 标签: 收藏本文

[AS3]as3加密算法遇到php字符转码与as3的解码,关于php的urlencode和as3的decodeURIComponent之间的互换。

PHP部分:

  1. <?php 
  2. $url=urlencode("http://www.cuplayer.com/Cu/Encrypt/test蓝精灵.mp4"); 
  3. echo $url; 
  4. ?> 

此时输出:http%3A%2F%2Fwww.cuplayer.com%2FCu%2FEncrypt%2Ftest%E8%93%9D%E7%B2%BE%E7%81%B5.mp4

AS3部分:

  1. var stemp:String ="http%3A%2F%2Fwww.cuplayer.com%2FCu%2FEncrypt%2
    Ftest%E8%93%9D%E7%B2%BE%E7%81%B5.mp4"
     
  2. var plain:String="http://www.cuplayer.com/Cu/Encrypt/test蓝精灵.mp4" 
  3. var plain2:String = encodeURIComponent(plain); 
  4. trace("输出1="+stemp); 
  5. trace("输出2="+encodeURIComponent(plain)); 
  6. trace("输出3="+decodeURIComponent(plain2)); 

输出结果:

  1. 输出1=http%3A%2F%2Fwww.cuplayer.com%2FCu%2FEncrypt%2Ftest%E8%93%9D%E7%B2%BE%E7%81%B5.mp4 
  2. 输出2=http%3A%2F%2Fwww.cuplayer.com%2FCu%2FEncrypt%2Ftest%E8%93%9D%E7%B2%BE%E7%81%B5.mp4 
  3. 输出3=http://www.cuplayer.com/Cu/Encrypt/test蓝精灵.mp4 

至此,就实现了php的urlencode和as3的decodeURIComponent之间的互换

ABOUT US
宜昌农人网络科技有限公司

我们是一家提供综合软件外包与弱电工程服务的技术公司。

业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。

公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室