PHP:会议不起作用


<?php
    if(isset($_POST['btnLogin']))
        {
             $id = $_POST['email'];
             $pass = $_POST['password'];
         // Resource Address
            $url ="http://localhost:81/RouteApp/ViewApi/?id=$id&pass=$pass";
         // Send Request To Resource
            $client = curl_init($url);
            curl_setopt($client,CURLOPT_RETURNTRANSFER,1);
         // get Response To Resource
            $response = curl_exec($client);

         // Decode it
            $result = json_decode($response);
            session_start();
             $res  =   (array)$result->data;
             foreach ($res as $key) {
                 $_SESSION['sessId']=$key[0];
                 $_SESSION['sessName']=$key[1];
                 $_SESSION['sessEmail']=$key[2];
             }
           header("Location:index.php");
        }
?>

每次使用会话时,都需要使用session_start()函数启动或恢复会话。

最新更新