FATAL ERROR语法错误,第48行意外T_STRING

时间:2015-08-10 02:29:52

标签: php

我有这个"致命错误语法错误,第48行和第34行的意外T_STRING,无法解释原因?我是php初学者。 :)

    public function __construct ($order, $params=array()) {
        $this->order_info=$order;
        $this->params = ( !empty($params) ) ? $params : $this->params;
    }

    public function sendMessage($phone_number, $msg_text){

            $phone_number = trim(str_replace(" ", "", $phone_number));          
            $user = $this->params['user'];
            $password = $this->params['password'];
            $senderID = $this->params['sender'];
            $curl = curl_init();
            $query_string = "http://gateway80.onewaysms.sg/api2.aspx?apiusername=".$user."apiusername&apipassword=".$password."&senderid=".$senderID."&mobileno=".$phone_number."&message=".rawurlencode(stripslashes($msg_text))."&languagetype=1"
            curl_setopt($curl, CURLOPT_URL, $this->$query_string); // here is the error
            $result = curl_exec($curl);
            curl_close($curl);
            echo $result;
            return new stdClass;
     }

感谢您的帮助。

干杯

1 个答案:

答案 0 :(得分:2)

你在$ query_string声明的末尾错过了;

$query_string = "http://gateway80.onewaysms.sg/api2.aspx?apiusername=".$user."apiusername&apipassword=".$password."&senderid=".$senderID."&mobileno=".$phone_number."&message=".rawurlencode(stripslashes($msg_text))."&languagetype=1";