致命错误:在第 1 行 /home/a7053783/public_html/index.php 中调用未定义的函数 get_header()
致命错误:调用未定义的函数 get_header() /home/a7053783/public_html/index.php 第 1 行。
如何修复上述错误?
Fatal error: Call to undefined function get_header() in
/home/a7053783/public_html/index.php on line 1.
How can I fix the error mentioned above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您可能正在创建自己的 WordPress 主题。我非常擅长 WordPress,但是您在您所谓的
get_header();< 中是否有与
index.php
位于同一文件夹中的header.php
文件/代码>?因为,如果您在实际主页上查看
index.php
主题文件..那么 WordPress 不太可能缺少该功能。此外,您还必须确保主题的
functions.php
文件已正确归档。我不记得函数文件中最关键的方面是什么。但这很可能就是问题所在。您可能需要使用这个来仔细检查所有主题创建步骤教程。另请注意,您可以从 wordpress.stackexchange.com 获得更好的与 wordpress 相关的答案。
As probably you are creating your own wordpress theme. I'm so good at wordpress, but do you have
header.php
file in the same folder asindex.php
in what you callget_header();
?Because, if you are viewing your
index.php
theme-file on the actual homepage..then it is unlikely, that wordpress is missing the function.Also you must make sure, that your theme's
functions.php
file is correctly filed. I cant remember anymore, what were the MOST critical aspects in the function-file. But this may very well be the problem.You probably want to double check all of your theme-creating-steps using this tutorial. And also let it be noted, that you can get better wordpress related answers from wordpress.stackexchange.com.
也许您想调用函数
get_headers()
?get_header()
不是标准 PHP 函数。顺便说一句:如果您提供实际代码出错的示例,那么帮助您会更容易。
Maybe you meant to call the function
get_headers()
?get_header()
is not a standard PHP function.By the way: it is way easier to help you if you include an example of the actual code going wrong.
由于此错误发生在第 1 行,我认为
get_header()
不可用。但我建议你把index.php的代码放在这里。
As this error occurs in line 1 i suppose
get_header()
is not avaialbe.But i recommend you put the code of index.php here.
我相信这是wordpress中的错误,尝试更改主题,如果错误继续存在,那么您可以确定这是主题的问题
i believe this is an error in wordpress, try changing the theme, if the error goes, then you can make sure that it is the problem of the theme
更多代码会有所帮助。
仅就该消息而言,我猜测您要么在包含包含
get_header()
函数的文件之前尝试调用get_header()
,要么您的意思是get_headers ()
。Some more code would help.
Regarding only that message I would guess that you either tryed to call
get_header()
before including the file that contains theget_header()
function, or that you meantget_headers()
.它主要是因为 get_header() 没有正确检查而出现
您可以通过简单地添加 if 条件顺便读取源来完成此操作
:
http://fixmycms.com/fatal-error-call-to-undefined-function-get_header-in-index-php-on-line-1/
It mostly Appear because of get_header() is not checking properly
you can do it via simply adding if condition
btw read source :
http://fixmycms.com/fatal-error-call-to-undefined-function-get_header-in-index-php-on-line-1/
我在最新版本(3.8.1 法语版)中遇到了同样的问题,
这真的很奇怪,但它似乎与模板中的 index.php 文件有关。
相反,根据所有视图的模板层次结构创建一个特定文件:front-page.php、page.php、single.php。
有关模板层次结构的更多信息,请参阅此链接
http://codex.wordpress.org/Template_Hierarchy
I've got the same problem with the latest version (3.8.1 french edition)
It is really weird but it seems to be related with your index.php file in the template.
Instead, create a specific file according to the template hierarchy for all the views: front-page.php, page.php, single.php.
Refer to this link for more info about template hierarchy
http://codex.wordpress.org/Template_Hierarchy