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

关于客户端返回字符串问题 #56

Closed
geekdawns opened this issue Aug 4, 2017 · 2 comments
Closed

关于客户端返回字符串问题 #56

geekdawns opened this issue Aug 4, 2017 · 2 comments

Comments

@geekdawns
Copy link

PHP框架 Yaf
服务器端:

<?php
class IndexController extends Rpc {

   /**
     * UserController::init()
     *
     * @return void
     */
    public function init() {
        parent::init();
        Yaf_Dispatcher::getInstance()->disableView();
    }
    public function indexAction(){}

    public function abcFunc($num) {//默认Action
        return 'Hello,'.$num;
    }

    public function adFunc($a){
      $a = '中国';
      $c = 'Hello';
      $b = array('asf','Hello','asdf','中国');

      return $b;
    }
}

客户端:

<?php
use Hprose\Client;

class IndexController extends Yaf_Controller_Abstract {
    protected $web = '';
    public function init(){
        $config = Yaf_Application::app()->getConfig();
        Yaf_Registry::set("config", $config);

        $rpc = $config->get("rpc");
        Yaf_Registry::set("rpc", $rpc);

        $this->web = Client::create($rpc->host . 'index', false);
    }

   public function indexAction() {//默认Action

        $a = $this->web->abcFunc(1);
        var_dump($a);
        exit;
        //$a = "Hello World";
        $this->getView()->assign("content", $a);
   }

   public function aaAction(){
     $a = $this->web->aaFunc();
     var_dump($a);
     exit;
   }
}
?>

问题:

服务端 修改 返回的变量 当为 $a 的时候,报错如下:

Yaf_Loader::autoload(): Failed opening script E:\xampp\htdocs\blog/application/\library\中国.php: No such file or directory

当为$c时,报错如下:

Yaf_Loader::autoload(): Failed opening script E:\xampp\htdocs\blog/application/\library\Hello.php: No such file or directory

联系QQ:
1684097410@qq.com

@geekdawns
Copy link
Author

访问 index.action 或 返回数组的时候,是正常的

@andot
Copy link
Member

andot commented Aug 4, 2017

你这个错误跟 Yaf 有关,跟 hprose 没关系。你那个错误是 Yaf 的错误,我也没办法。

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

2 participants