Created
June 20, 2015 10:44
-
-
Save xemoe/6fc549bf2e9bb4828757 to your computer and use it in GitHub Desktop.
test.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Car { | |
public static function test() { | |
echo 'test'; | |
} | |
} | |
class TestService { | |
private function model() { | |
return 'Car'; | |
} | |
public function getTest1(){ | |
echo Car::test(); | |
} | |
public function getTest(){ | |
// echo $this->mode()::test(); | |
} | |
} | |
$app = new TestService(); | |
$app->getTest1(); |
<?php
class Car
{
public static function test()
{
echo 'test';
}
}
class TestService
{
private function model()
{
return 'Car';
}
public function getTest()
{
$ref = new ReflectionClass($this->model());
$ref->getMethod('test')->invoke(null);
}
}
$app = new TestService();
$app->getTest();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ใส่ก็ไม่ได้ครับ