Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用了httpserver和httpclient做测试,然后报错了 #26

Closed
kkshow opened this issue Aug 12, 2016 · 5 comments
Closed

用了httpserver和httpclient做测试,然后报错了 #26

kkshow opened this issue Aug 12, 2016 · 5 comments

Comments

@kkshow
Copy link

kkshow commented Aug 12, 2016

代码都是直接从readme里面取的,稍微调整了一下,server正常,client报错了

server

<?php
require_once('hprosesrc\Hprose.php');

function hello($name) {
    return 'Hello ' . $name;
}

$server = new HproseHttpServer();
$server->addFunction('hello');
$server->start();

client

<?php
require_once('hprosesrc\Hprose.php');
$client = new HproseHttpClient('http://127.0.0.1/helloserver.php');
echo $client->hello('World');

错误提示

Object of class Hprose\Future could not be converted to string

环境是windows php5.4.16

@andot
Copy link
Member

andot commented Aug 12, 2016

你复制到是旧的 README 的代码,新的 README 中并没有代码。

新版本的文档在这里:https://github.com/hprose/hprose-php/wiki

你的客户端代码只需要这样修改一下就可以了:

<?php
require_once('hprosesrc\Hprose.php');
$client = new HproseHttpClient('http://127.0.0.1/helloserver.php', false);
echo $client->hello('World');

@kkshow
Copy link
Author

kkshow commented Aug 12, 2016

吐血,加了个参数果然可以了,我看的是这个路径 https://github.com/hprose/hprose-php/tree/87a4e1bdc5b360096634b3a3f8d49074643624a3 和doc文档里面的案例。

这个最好还是统一一下比较好。

@kkshow kkshow closed this as completed Aug 12, 2016
@andot
Copy link
Member

andot commented Aug 12, 2016

你看的是 github 的历史记录,历史的内容改不了。

@yesterday679
Copy link

@andot 对于THINKPHP这种框架,怎么加入controller中的method呢?

@andot
Copy link
Member

andot commented Jan 16, 2017

发布的服务最好单独编写,把 Controller 中的方法发布为服务这种做法是不合适的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants