微信 微博 对外开放很多的API 接口  是如何保证其安全性的  如何预防攻击的

解决方案 »

  1.   

    加密,解密。
    把传递的参数加密(token)。然后在服务器端解密。
    require 'aes.class.php';
    require 'aesctr.class.php';
    $key = 'abcdef'; // 密钥$param = array(
        'name' => 'fdipzone',
        'password' => '123456',
        'time' => time()
    )$token = AesCtr::encrypt(json_encode($param), $key, 256); // 加密// 服务器接收后
    $data = json_decode(AesCtr::decrypt($token, $key, 256), true);
    'aes.class.php  aesctr.class.php 参考:http://blog.csdn.net/fdipzone/article/details/8178982
      

  2.   

      谢谢fdipzone的回答   我去看看