Re: Question about display pictures, submit pictures [Ok in PHP 7.4.33, fail in 8.0.26]

Serge Fonville <[email protected]>
Newsgroups gmane.comp.php.general
Message-ID <CAOAS_+LT-soKjQFq8PNkXvvcCveiYyByafKfRFSFjGkF7nxcRw@mail.gmail.com>
Additionally,

In 8.0.26, the include file takes effect, but the parameters are not
> correctly transmitted, and the related parameters are not invoked,
> resulting in the failure of this function.
> Could you try and access the variables that exist in the enclosing scope
> from within the included file?


If you are trying to do an HTTP request, please look at* Example #3 include
through HTTP*

> <?php
> /* This example assumes that www.example.com is configured to parse .php
> * files and not .txt files. Also, 'Works' here means that the variables
> * $foo and $bar are available within the included file. */

// Won't work; file.txt wasn't handled by www.example.com as PHP
> include 'http://www.example.com/file.txt?foo=1&bar=2';
>
> // Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
> // local filesystem.
> include 'file.php?foo=1&bar=2';
>
> // Works.
> include 'http://www.example.com/file.php?foo=1&bar=2';
> ?>


Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl


Op ma 29 jan 2024 om 10:58 schreef Serge Fonville <[email protected]
>:

> Hi Zoe,
>
> <include file="Public/uploadimg" id="picture" value="{$model.picture}"
>> width="100" path="banner" thumbw="" thumbh="" />
>>
>> No parameter values were transferred after the call:
>> Public/uploadimg
>> <div>
>>     <input type="file" id="upload[id]" name="upload[id]">
>>     <input type="hidden" id="[id]" name="[id]" value="[value]">
>>     <div id="div[id]" style=" margin:10px 0px;">
>>     <a href="[value]" id="a[id]" target="_blank">
>
> In 8.0.26, the include file takes effect, but the parameters are not
>> correctly transmitted, and the related parameters are not invoked,
>> resulting in the failure of this function.
>
>
> From https://www.php.net/manual/en/function.include.php
>
>> When a file is included, the code it contains inherits the variable scope
>> of the line on which the include occurs. Any variables available at that
>> line in the calling file will be available within the called file, from
>> that point forward. However, all functions and classes defined in the
>> included file have the global scope.
>
>
> Could you try and access the variables that exist in the enclosing scope
> from within the included file?
>
> Op ma 29 jan 2024 10:42 schreef mingzoe l <[email protected]>:
>
>> Dear Supporter,
>>
>> The website background management system needs to upload pictures and
>> submit them so that the pictures displayed on the website can be updated.
>>
>> I can use them normally in 7.4.33 ,but when I updated php to 8.0.26, this
>> function cannot be used I have tried many ways but failed to fix this
>> function. It is found that after the include file in 7.4.33, the
>> transmitted parameters can be normally obtained and used. However, in
>> 8.0.26, the include file takes effect, but the parameters are not correctly
>> transmitted, and the related parameters are not invoked, resulting in the
>> failure of this function.
>>
>> May I ask how to solve this problem? I am looking forward to your reply,
>> which will be of great help to me.
>>
>>
>>
>> Thanks a lot.
>>
>>
>>
>> Page:
>>
>> <include file="Public/uploadimg" id="picture" value="{$model.picture}"
>> width="100" path="banner" thumbw="" thumbh="" />
>>
>>
>>
>> No parameter values were transferred after the call:
>>
>> Public/uploadimg
>>
>> <div>
>>
>>     <input type="file" id="upload[id]" name="upload[id]">
>>
>>     <input type="hidden" id="[id]" name="[id]" value="[value]">
>>
>>     <div id="div[id]" style=" margin:10px 0px;">
>>     <a href="[value]" id="a[id]" target="_blank">
>>
>>
>>
>> Zoe Liu
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.