Home > Backend Development > PHP Tutorial > Problem with php post receiving.

Problem with php post receiving.

WBOY
Release: 2016-08-04 09:19:52
Original
1578 people have browsed it

HTML 向PHP post一条数据 $_POST['pic'];
其中数据为http://www.baidu.com/1.pic;ht...等等
如何循环这条语句 每个$pic获取一条地址

<code> array('image_src' => $pic, 'image_name' => '随机字符串.jpg'),
);</code>
Copy after login
Copy after login

回复内容:

HTML 向PHP post一条数据 $_POST['pic'];
其中数据为http://www.baidu.com/1.pic;ht...等等
如何循环这条语句 每个$pic获取一条地址

<code> array('image_src' => $pic, 'image_name' => '随机字符串.jpg'),
);</code>
Copy after login
Copy after login

HTML

<code class="html"><form action="http://www.godruoyi.com/" method="get">
    
    <input type="text" name="pic[]">
    <input type="text" name="pic[]">
    <input type="text" name="pic[]">
    <input type="text" name="pic[]">

    <input type="submit" name="save">
</form></code>
Copy after login

php

<code class="php">    $pics = $_GET['pic'];
    $data = [];
    foreach ($pics as $key => $value) {
        $data[] = [
            'image_src'  =>$value,
            'image_name' => mt_rand(1, 1111) . '.jpg'
        ];
    }

    //over</code>
Copy after login

pic[]=XXX.jpg&pic[]=XXX.jpg

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template