草庐IT

dll-interface

全部标签

php - PHP 接口(interface)的最佳实践 : should I document only the interface?

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭7年前。Improvethisquestion我正在尝试标准化PHP接口(interface)的文档。最好的做法是只在接口(interface)中维护方法头吗?例如,对于这个界面:interfaceFooInterface{/***Thiswilltestthesysteminsomespecialway*@paramstring$sName*@paraminteger$iCount*@returnvoid*/publicfuncti

php - 将接口(interface)作为函数参数(PHP)传递?

我正在观看有关编码规则的JeffsLaracast教程之一。functionsignUp($subscription){if($subscription=='monthly'){$this->createMonthlySubscription();}elseif($subscription=='forever'){$this->createForeverSubscription();}}他想在这里使用多态和接口(interface)。他将上面的代码修改为:functionsignUp(Subscription$subscription){$subscription->create();

PHP 接口(interface)实现拒绝参数的子类

考虑一下:classA{}classBextendsA{}interfaceI{//expectsobjectinstanceofAfunctiondoSomething(A$a);}classCimplementsI{//fails????functiondoSomething(B$b){}}在我的概念中,上面应该工作,但它不作为php拒绝要求第一个参数与接口(interface)(I)中定义的类型(A)完全相同的实现。由于B是A的子类,所以我看不出有什么问题。我在这里遗漏了什么吗? 最佳答案 classCimplementsI意

php与dll通信?

我需要使用php将数据(在本例中只是一个id)传递给自定义dll。你能直接在php中使用dll吗?在我不确定它是如何工作之前,我从未使用过dll。它在本质上是否类似于Web服务或rpc? 最佳答案 因为这是一个自定义DLL,也许你会considermakingaPHPextension?或者,PHP支持COM。如果您可以制作COMDLL,那么您的状态很好:http://us.php.net/COM最后,它是否可以与rundll32一起使用??如果是这样,您可以使用exec()调用它。 关

php - 在接口(interface)实现中覆盖参数类型

假设我有一个模型接口(interface):interfaceModel{}接口(interface)中的一个函数接收该模型作为参数:interfaceService{publicfunctionadd(Model$model);}为什么,当我使用另一个实现上述服务的模型来实现该服务时:classAnotherModelimplementsModel{}classAnotherServiceimplementsService{publicfunctionadd(AnotherModel$model);}我收到这个错误:Fatalerror:DeclarationofAnotherSer

php - 完全合格的接口(interface)名称

有没有办法获得类似于MyClass::class的完全限定接口(interface)名称?例如:namespaceExample\Tests;useExample\Interfaces\InputInterface;...classCommandTest......publicfunctioncreateInputMock(){//IwanttoreplacenextstringwithsomethingsimilartoMyClass::class$this->getMockBuilder('Example\Interfaces\InputInterface')...谢谢。

php - 从 php 调用 F# (.Net dll) 代码

我想知道是否可以从php调用一些F#代码。似乎Phalanger可以解决问题。有人在用吗?对于此解决方案和其他解决方案(如果有的话?),运行代码对服务器有什么要求?谢谢 最佳答案 是的,您可以使用PHPCOM类,但它仅适用于Windows版本的PHP5+,无需单独安装。所以,你这样做:HelloWorld();//Callthe"HelloWorld()"methodfromtheDLL.//oncewecreatedtheCOMobjectthiscanbeusedlikeanyotherphpclasses.echo$outpu

php - PHP 中 ArrayAccess 接口(interface)的好处?

在PHP中实现ArrayAccess接口(interface),我们可以访问对象属性作为数组键。让对象的行为像数组有什么好处?就像我看到使用ArrayAccessInterface实现“FORM”的框架一样然后我们可以访问(HTML)表单对象字段,例如,$form['nameField']instead-of$form->nameField$form['titleField']instead-of$form->titleField使用$form['nameField]代替$form->nameField有什么好处?是“数组数据结构”的速度还是对象和数组形式之间的可移植性?或者我错过了什

php - 从继承接口(interface)的类调用静态方法

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:Referringtoastaticmemberofasubclass请查看以下代码以了解我的问题。有没有办法强制抽象returnSomething(),同时保持从抽象“中间人”类中定义的函数调用函数的可能性?对我来说,这似乎是PHP的瓶颈。

php - 接口(interface)和抽象类的优点是什么?

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicates:purposeofinterfaceinclassesWhatisthedifferencebetweenaninterfaceandabstractclass?大家好,我是一名PHP程序员。任何人都可以解释使用接口(interface)和抽象类的优势是什么。