나는 아래의 content
섹션에 PHP 파일 (html, css 및 javascript)을 가져 오는 방법을 알아 내려고하고 있습니다.file_get_contents의 내용을 출력하는 방법
다음은
function wpse_124979_add_help_tabs() {
if ($screen = get_current_screen()) {
$help_tabs = $screen->get_help_tabs();
$screen->remove_help_tabs();
$screen->add_help_tab(array(
'id' => 'my_help_tab',
'title' => 'Help',
'content' => 'HTML CONTENT',
나는 다음과 같은 시도했지만 실패했다 ... 원래이다. 나는 'content' => $adminhelp
그것을에서 당겨 시도 후 file_get_contents
(첫 번째 줄)을 추가하고,
그 ... 내 개정 코드로되어 다음
$adminhelp = file_get_contents('admin-help.php');
function wpse_124979_add_help_tabs() {
if ($screen = get_current_screen()) {
$help_tabs = $screen->get_help_tabs();
$screen->remove_help_tabs();
$screen->add_help_tab(array(
'id' => 'my_help_tab',
'title' => 'WTV Help',
'content' => $adminhelp,
무슨 일이야 어떤 아이디어?
당신의'$ adminhelp' 변수는 함수 내에서 범위 내에 있지 않습니다 - 함수를 전달하거나 함수 안에서 그 라인을 옮길 필요가 있습니다. http://php.net/manual/en/language.variables.scope.php를 참조하십시오. – iainn
@iainn이 말했듯이, 여러분은 범위 밖에서'$ adminhelp'라고 부릅니다. '$ adminhelp = file_get_contents ('admin-help.php'); '당신의 기능 안에서. – AndyWarren
감사합니다. – Jane