How to make an object public?

前端 未结 3 1606
时光说笑
时光说笑 2021-01-27 20:08

how would I go about getting around the \"protected\" so I can output the data.

tabs\\api\\property\\Property Object ( 
    [id:protected] => 90_4_HH 
    [pr         


        
3条回答
  •  走了就别回头了
    2021-01-27 20:25

    Your title implies that you want to make -the class (not object)- public, as opposed to "internal"/etc.. All classes are public in PHP.

    Your question says that you want to get around method/property scope (disagrees with title). You didn't say what you've tried. You also didn't indicate whether this is a class you developed or not. If you have control over it, add a freaking method or two to allow you to get the data. If you don't, then inspect the methods, and/or attempt reflection. These answers apply to every OOP language in existence.

    Before asking other people, read the documentation.

    http://www.php.net/manual/en/language.oop5.basic.php

提交回复
热议问题