开发者

Include not functioning like I am expecting

The below gives me a fatal error saying that "mymail" was not found.

Any ideas why? Looks right to me.

mailreq.php

include("mail.php");
$r = mymail(开发者_如何学C"test","test");

mail.php

function mymail($body, $reqtype)
{
 //blah blah
}

EDIT: For some reason, this version of php doesn't see <? ?> as valid shorthand tags. I changed it to <?php ?> and it sees the functions now.


If mymail() wasn't found, the problem is presumably with the path to the included file. You might try using require() instead, that way the script will (if I remember rightly) stop running if the required file isn't found.


I can't see anything wrong with what you posted. Are you sure it wasn't some little mistake somewhere - like maybe you forgot the <?php and ?> in the mail.php file? Or maybe a pathing issue?


You're either not passing the correct path of mail.php or there is no mymail function in mail.php. What are the absolute paths of mail.php and mailreq.php?

It appears your script requires mail.php, so use require 'mail.php' (or whatever the correct path is).


The reason why you are getting the error ... was not found. is most likely because you are not specifying the correct path for the mail.php. Make sure that you are specifying the correct path.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜