PHP基础问题???

lys07962000 2018-04-02 09:03:17
问题一:
Error: Client, string: looks like we got no XML document

<?php
//client端soap_client.php
try
{
@$oper_post = $_GET['post'];
@$oper_get = $_GET['get'];
$client = new SoapClient(null,
array('location' =>"http://127.0.0.1:8090/soap_server.php",'uri' => "http://127.0.0.1:8090/")
);
//echo $client->getName();
// http://120.79.230.135:8090/clientsoap.php?get=login&mobilephone=13728644592&password=123
if($oper_get != null)
{
switch($oper_get)
{
case "login":// 登录
{
$Relust = $client->GetLogin('login', $_GET['mobilephone'], $_GET['password']);// $userid 只查询某一个投资人
break;
}
}
}/**/
echo $Relust;
}
catch (SoapFault $fault)
{
echo "Error: ",$fault->faultcode,", string: ",$fault->faultstring;
}
?>
//////soap_server.php
<?php
include './soap_query.php';

$classExample = array();
$soap = new SoapServer(null,array('uri'=>"http://127.0.0.1:8090/",'classExample'=>$classExample));
$soap->setClass('OperationData');
$soap->handle();
// 注释 include './soap_query.php', QueryData 移到 soap_query.php 则出现
// Error: Client, string: looks like we got no XML document
/*
function QueryData($sql, $rootname)
{
return '00000';
}
*/
class OperationData
{
public $name = 'Chester';

function getName()
{
return $this->name;
}

function GetLogin($rootname, $phone, $passward)
{
$sql = 'select mobilephone from userinfo where mobilephone=';
$strpoint ="'";
$sql = $sql.$strpoint.$phone.$strpoint;
$sqland = ' and passward =';
$sqland = $sqland.$strpoint.$passward.$strpoint;
$sql = $sql.$sqland;
return QueryData($sql, $rootname);
}
}
?>
/////soap_query.php
<?php
function QueryData($sql, $rootname)
{
return '00000';
}
?>

问题二:
在php文件的开头加上:
header("Content-type:text/xml")
报错:
//This page contins the following errors:
//error on line 2 at column 1: Extra content at the end of the document
//Below is a rendering of the page up to the first error.
...全文
981 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lys07962000 2018-04-02
  • 打赏
  • 举报
回复
// 不注释 include './soap_query.php', QueryData 移到 soap_query.php 则出现 // Error: Client, string: looks like we got no XML document /* function QueryData($sql, $rootname) { return '00000'; } */
xuzuning 2018-04-02
  • 打赏
  • 举报
回复
Error: Client, string: looks like we got no XML document 错误:客户机,字符串:看起来我们没有XML文档 //This page contins the following errors: //error on line 2 at column 1: Extra content at the end of the document //Below is a rendering of the page up to the first error. / /此页面含有以下错误: /第2行第1行的错误:文档结尾处的额外内容 //下面是对第一个错误的页面呈现。

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧