RE: [PHP] Function declaration and use
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Wed, 27 Sep 2000 07:27:26 +0000 |
| Subject: | RE: [PHP] Function declaration and use | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17733@lists.php.net to get a copy of this message | ||
Because...
http://alecto.bittwiddlers.com/private/testprint.php3
will return the parsed version from what the browser sees.
Use
require ($DOCUMENT_ROOT . "/private/testprint.php3");
See:
$DOCUMENT_ROOT in php manual for more details;
in general for includes in current *working* directory
require "xxx.php";
for specific paths
require $DOCUMENT_ROOT . "/mypath/xxx.php";
require "http://www.xxx.com/xxx.php"; is
not correct, thats a http
connection to your server, which will probably serve you the output of
xxx.php as its configured to, not the source you're trying to include.
-----Original Message-----
From: Matthew Harrell [mailto:mharrell@bittwiddlers.com]
Sent: September 25, 2000 04:45 AM
To: PHP General List
Subject: [PHP] Function declaration and use
Hi,
I'm new to PHP so maybe this is much easier than I'm making it.
Also,
I'm currently using PHP 3.0.16.
I've currently got an HTML page that looks like
<html>
<?php
include ( "http://alecto.bittwiddlers.com/private/testprint.php3"
);
testprint ( "this is a test string" );
?>
</html>
with the function testprint.php3 containing
<?php
function testprint ( $string ) {
echo "This is a test<BR>\n";
echo $string . "<BR>\n";
}
?>
but when I try to load the page I get the error
Fatal error: Call to unsupported or undefined function testprint() in
/usr/local/apache/htdocs/files/test1.php3 on line 7
If I directly put the function in the page (without the include) then it
works
fine. What am I doing wrong?
Thanks
--
Matthew Harrell Beauty is in the eye of the beer
Bit Twiddlers, Inc. holder.
mharrell@bittwiddlers.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net