Including files that have query strings

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • theboss3@gmail.com

    Including files that have query strings

    I am having trouble with accessing files with query strings. For
    example the code "require 'template.php?1 02932'" gives the following
    error:


    Warning: main(/www/blog/template.php?10 2932): failed to open stream:
    Invalid argument in C:\www\blog\200 4\12\27\best-of-2004\index.php on
    line 54

    Fatal error: main(): Failed opening required
    '/www/blog/template.php?10 2932' (include_path=' .;c:\php4\pear' ) in
    C:\www\blog\200 4\12\27\best-of-2004\index.php on line 54

    I have no idea what's going on. Is it impossible to open files with
    query strings in PHP? I am running PHP 4.3.9 on Apache 2/Win.

  • Alvaro G. Vicario

    #2
    Re: Including files that have query strings

    *** theboss3@gmail. com escribió/wrote (21 Jan 2005 23:25:19 -0800):[color=blue]
    > Warning: main(/www/blog/template.php?10 2932): failed to open stream:
    > Invalid argument in C:\www\blog\200 4\12\27\best-of-2004\index.php on
    > line 54
    >
    > I have no idea what's going on. Is it impossible to open files with
    > query strings in PHP? I am running PHP 4.3.9 on Apache 2/Win.[/color]

    Files do not have query strings. URLs do have query strings.

    If you want to create a variable to use in the included file, why don't you
    just, well, do it? Including a file is exactly the same as copying its
    contents in current file.

    <?
    $foo=102932;
    require('templa te.php');
    ?>

    --
    -+ Álvaro G. Vicario - Burgos, Spain
    +- http://www.demogracia.com (la web de humor barnizada para la intemperie)
    ++ Las dudas informáticas recibidas por correo irán directas a la papelera
    -+ I'm not a free help desk, please don't e-mail me your questions
    --

    Comment

    Working...