douye7033 2013-05-30 08:40
浏览 70
已采纳

OOP与PHP(Web服务)

I am familiary with OOP in Java or .Net world, now I'm asked to work with OOP same in PHP in my company, but it seems total different, since in PHP we don't have strong type variables and I never did any OOP before in PHP. The task was actually to integrate an API(Qlikview) written in .NET and to do the same functionalities in PHP like in that API. Documentation can be found: http://community.qlikview.com/docs/DOC-2606

And to connect to the services, I create a new class which will be connected to ('http://:4799/QMS'). So far everything is working. But I've got an issue in changing the properties in my QMS. The QMS is installed on the server itself.

Let's say, I've following code:

List<DocumentFolder> DocFolders = BackendClient.GetUserDocumentFolders(QvsGuid, DocumentFolderScope.All);

I would write it actually like in buttom code in order to get those information that I require(QvsGuid and DocumentFolderScope.All):

$DocFolders=(object)array();
$DocFolders=$this->client->GetUserDocumentFolders(array('qvsID' => getQlikviewServerInfo()->ServiceInfo->ID, 'scope' => 'General'))->GetUserDocumentFoldersResult->DocumentFolder;

But on execution, I get:

 Call to a member function GetUserDocumentFolders() on a non-object

So I thought, I might have to create a class for $DocFolders of type DocumentFolder.

I know it might be only a focused group of people that might reply concerning the API, but I hope someone could open a new road of perspective.

  • 写回答

1条回答 默认 最新

  • dongtiao2066 2013-05-30 08:45
    关注

    Call to a member function GetUserDocumentFolders() on a non-object

    That error means that $this->client is not an object, more than likely its null and has not been set yet.

    You have to set $this->client to an instance of whatever class has the GetUserDocumentFolders function

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥50 vue组件中无法正确接收并处理axios请求
  • ¥15 隐藏系统界面pdf的打印、下载按钮
  • ¥15 MATLAB联合adams仿真卡死如何解决(代码模型无问题)
  • ¥15 基于pso参数优化的LightGBM分类模型
  • ¥15 安装Paddleocr时报错无法解决
  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题
  • ¥15 人在外地出差,速帮一点点
  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改