drop0118
这里有个奇怪的现象,每当我对webservice服务端的程序进行改动之后,第一次访问这个页面WSDL中就有函数方法描述
,但是刷新一次就没有了,不知道是为什么。- drop0118 回复了话题 转载 PHP Yii框架相关知识
看得眼花了·
对了···这个$model=new Upload;
Upload类是Yii内置的嘛?呃···不知道我这么问是不是太外行了这个我有注意到呢···路径全部都是正确的···要不然报的错也不是这个了···
很厉害···学习了!
呃···这是WebController.php的代码
<?php class WebController extends Controller { public function actions() { return array( 'quote'=>array( 'class'=>'CWebServiceAction', ), ); } /** * @param string the symbol of the stock * @return string the stock price * @soap */ public function getPrice($symbol) { $prices=array('IBM'=>100, 'GOOGLE'=>350); return isset($prices[$symbol])?$prices[$symbol]:0; //...return stock price for $symbol } /** * * @return string * @soap */ public function test() { return "test"; } }
然后客户端的代码就是官方的写法
$client=new SoapClient('http://hostname/path/to/index.php?r=stock/quote'); echo $client->getPrice('GOOGLE');
个人能力还有待提高啊····:(
舰长···回个话呗···觉得我那个提议怎么样啊···
我有个提议呀···我们一起搞个高端社会精英的网络俱乐部吧···
就没有人使用过Yii的webservice功能吗?