dongliang1941 2013-05-09 16:29
浏览 21
已采纳

是否有PHP等效的Objective-C类别?

For the short period of time I subjected myself to Objective-C, I swore a lot, but one thing I thought was fabulous was categories.

I could add a method to the NSString object as a category, and it was available on any NSString object in my application. Something similar is now possible in Delphi and probably many other languages.

Is that possible in PHP?

If so is there a good tutorial, and can I extend the PDO object?

I have searched helpers and categories with little success. I seem to remember reading that it was possible.

  • 写回答

1条回答 默认 最新

  • duancaoqin6683 2013-05-09 16:41
    关注

    No it is not possible in PHP to add functionality to existing native classes.

    And yes it is indeed possible to extend PDO.

    class MyClass extends PDO { /* All your class stuff here */ }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答