You are here: Re: How to return a file « PHP Programming Language « IT news, forums, messages
Re: How to return a file

Posted by Tyrone Slothrop on 10/17/06 03:19

On 16 Oct 2006 19:41:14 -0700, "Bryan" <BTRichardson@gmail.com> wrote:

>Hello all,
>
>In some html code I have the following:
>
><script type='text/javascript' src='foo.js'></script>
>
>However, I'd like to replace 'foo.js' with something like
>"bar.php?file=foo" and have bar.php echo foo.js back to the script
>element. Is this possible?

First, a query string will not work with an include, like:
<? include('bar.php?file=foo'); }

However, you can create a function:

function foo($file)
{
include ('$file.js');
}

<?=foo('foo')?>

Also review file_get_contents() and readfile().

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация