Addons::createAddonShow PHP Метод

createAddonShow() публичный статический Метод

createAddonShow 为插件的展示页快速创建一个链接
public static createAddonShow ( mixed $name, mixed $hooks, mixed $param = null )
$name mixed
$hooks mixed
$param mixed
    public static function createAddonShow($name, $hooks, $param = null)
    {
        $param['addon'] = $name;
        $param['hook'] = $hooks;
        return U('public/Widget/displayAddons', $param);
    }

Usage Example

Пример #1
0
 function checkUser()
 {
     if ($_REQUEST['code']) {
         $redirect_uri = Addons::createAddonShow('Login', 'no_register_display', array('type' => 'taobao', 'do' => "bind"));
         $url = 'https://oauth.taobao.com/token';
         $field = 'grant_type=authorization_code&client_id=' . TAOBAO_KEY . '&code=' . $_REQUEST['code'] . '&client_secret=' . TAOBAO_SECRET . '&redirect_uri=' . urlencode($redirect_uri);
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $field);
         $result = curl_exec($ch);
         $res = json_decode($result, TRUE);
         if ($res['taobao_user_id']) {
             $_SESSION['taobao']['access_token']['oauth_token'] = $res['access_token'];
             $_SESSION['taobao']['access_token']['oauth_token_secret'] = $res['refresh_token'];
             $_SESSION['taobao']['isSync'] = 1;
             $_SESSION['taobao']['uid'] = $res['taobao_user_id'];
             $_SESSION['taobao']['uname'] = $res['taobao_user_nick'];
             $_SESSION['taobao']['userface'] = '';
             $_SESSION['open_platform_type'] = 'taobao';
             return $res;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
All Usage Examples Of Addons::createAddonShow