The process is like this
Parse the sent XML to get the content sent by the user
According to the content, to determine the response
Reads the contents of the database, returns as a string, replies to information
But there seems to be a problem in the database operation, how can not reply. case '1'
everything else is fine.
I tried to add a test to each step in the method getSql()
echo '成功'
, and no longer returned to the place where I commented, and the gods see what's going on.
How to view support? mysqli
I am the content of the CentOS 6.7 php 5.6 phpinfo()
display about mysqli as follows:
I know that there is a extension open on the PHP in Windows, what is the PHP configuration inside Linux?
/*-------------------------------------judge the information event, according to the information content sent by the user, determine the reply $arr: the parsed Data sent--------------------------------------*/Public Function Rsptext ($arr) {switch (Strtolower ($arr->co ntent)) {case ' 1 ': {$this->replymsg ($arr, "success"); };break; Case ' 2 ': {$this->replymsg ($arr, $this->getsql ()); };break; Case ' time ': {$this->replymsg ($arr, Date ("y-m-d"). " \ n ". Date (" H:i:s ")); };break; Default: $this->replymsg ($arr, "See the Sea Yo"); }}/*-----------------------------------reply message $arr: Post data parsed object $content: What to reply to, String-----------------------------------*/Public Function replymsg ($arr, $content = "") {$toUser = $arr->tous Ername; $fromUser = $arr->fromusername; $time = time (); $msgType = ' text '; $rspPatten = '
%s
%s
%s
%s
%s
'; $RSPMSG = sprintf ($rspPatten, $fromUser, $toUser, $time, $msgType, $content); Echo $RSPMSG; }//Read Database contents public Function GetSQL () {$host = "111.111.111.111"; $port = ' 1111 '; $database = "WordPress"; $table = "Wp_posts"; $user = "1111"; $passwd = "1111"; $sql = "Select Post_title from" $table. "Limit 1,10"; !!!!!!!!! Can still return here, the following sentence will no longer return to the!!!!!!! $link = Mysqli_connect ($host, $user, $passwd, $database, $port); $tempResult = $link->query ($sql); $str = ""; while ($row = $tempResult->fetch_array ()) {$str = $str. $row [' Post_title ']; } $link->close (); return $str; Return string}
Reply content:
The process is like this
Parse the sent XML to get the content sent by the user
According to the content, to determine the response
Reads the contents of the database, returns as a string, replies to information
But there seems to be a problem in the database operation, how can not reply. case '1'
everything else is fine.
I tried to add a test to each step in the method getSql()
echo '成功'
, and no longer returned to the place where I commented, and the gods see what's going on.
How to view support? mysqli
I am the content of the CentOS 6.7 php 5.6 phpinfo()
display about mysqli as follows:
I know that there is a extension open on the PHP in Windows, what is the PHP configuration inside Linux?
/*-------------------------------------judge the information event, according to the information content sent by the user, determine the reply $arr: the parsed Data sent--------------------------------------*/Public Function Rsptext ($arr) {switch (Strtolower ($arr->co ntent)) {case ' 1 ': {$this->replymsg ($arr, "success"); };break; Case ' 2 ': {$this->replymsg ($arr, $this->getsql ()); };break; Case ' time ': {$this->replymsg ($arr, Date ("y-m-d"). " \ n ". Date (" H:i:s ")); };break; Default: $this->replymsg ($arr, "See the Sea Yo"); }}/*-----------------------------------reply message $arr: Post data parsed object $content: What to reply to, String-----------------------------------*/Public Function replymsg ($arr, $content = "") {$toUser = $arr->tous Ername; $fromUser = $arr->fromusername; $time = time (); $msgType = ' text '; $rspPatten = '
%s
%s
%s
%s
%s
'; $RSPMSG = sprintf ($rspPatten, $fromUser, $toUser, $time, $msgType, $content); Echo $RSPMSG; }//Read Database contents public Function GetSQL () {$host = "111.111.111.111"; $port = ' 1111 '; $database = "WordPress"; $table = "Wp_posts"; $user = "1111"; $passwd = "1111"; $sql = "Select Post_title from" $table. "Limit 1,10"; !!!!!!!!! Can still return here, the following sentence will no longer return to the!!!!!!! $link = Mysqli_connect ($host, $user, $passwd, $database, $port); $tempResult = $link->query ($sql); $str = ""; while ($row = $tempResult->fetch_array ()) {$str = $str. $row [' Post_title ']; } $link->close (); return $str; Return string}
Database this part of every row is right, put together is wrong.
The front is a process-oriented approach to connectivitymysqli_connect
Subsequent queries and values are object-oriented methods
mysqli_connect
Change new mysqli
it.
Try using mysql_connect (), mysql_select_db (), and mysql_query () to process