php post接收的问题。
本文介绍了php post接收的问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
HTML 向PHP post一条数据 $_POST['pic'];
其中数据为http://www.baidu.com/1.pic;ht...等等
如何循环这条语句 每个$pic获取一条地址
array('image_src' => $pic, 'image_name' => '随机字符串.jpg'),
);
解决方案
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>
php
$pics = $_GET['pic'];
$data = [];
foreach ($pics as $key => $value) {
$data[] = [
'image_src' =>$value,
'image_name' => mt_rand(1, 1111) . '.jpg'
];
}
//over
这篇关于php post接收的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文