开发者

An require_once in another require_once - some functions work, others don't - PHP

This is a tricky one to explain. So I'll bullet point it:

  • I have a file that require_once all my settings files and classes ...I call it start.php
  • I require_once that file in my index.php
  • My index.php file then I require_once a another file called home.php

This scripts works perfectly on my localhost server. Now my issue presents itself when I try it on my online server and some functions seem to be working while others are not and I get this error:

Fatal error: Call to undefined function update_display() in /xxxxx/home.php on line 146

Now I know "Fatale error" is because I require_once, but what I don't understand is why some functions seem to be working while others do not?

Also worth mentioning that if I do require_once in my home.php file, it says that I am de开发者_如何学编程claring the function twice!

Any help, much appreciated.


You may use such useful functions as get_included_files and get_include_path to diagnose a problem. Just print their result somewhere (for instance in /xxxxx/home.php just before update_display call). Also you can list defined functions using get_defined_functions(). This will help you to clear up what's actually loaded.


have you tried to convert php starting tags from:

<?

to:

<?php

? HTH

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜