내가, 하나 개의 기능 테스트 클래스를 가지고 예를 들어, 내가 포함 된 페이지와이 클래스의 기능을 사용할 수 있지만 내가 포함 된 페이지의 기능에 대한이 기능을 사용하지 못할 것을 포함 후 :PHP 사용 클래스 기능
testClass.php : 내가 문제
text.php에게 해달라고 사용하여이 클래스 : 0 클래스를 포함
class test
{
public function alert_test($message)
{
return $message;
}
}
<?php
include 'testClass.php';
$t= new test;
echo alert_test('HELLO WORLD');
?>
하지만 난이 방법 alert_test 기능을 사용하지 못할 :
<?php
include 'testClass.php';
$t= new test;
function test1 ($message)
{
echo alert_test('HELLO WORLD');
/*
OR
echo $t->alert_test('HELLO WORLD');
*/
}
?>
난 하위 기능
echo $t->alert_test('HELLO WORLD');
에 대한
고마워,하지만 클래스 파일에 alert_test 함수를 사용하는 걸 좋아하지 않아. –