Javascript-html js value php problem.

Source: Internet
Author: User
Maybe my train of thought is not good, to do is a multi-select picture, click on the Auto Pack zip, and then in the download.
Zip already has, PHP does not understand, on the front end made a form get multiple picture address to PHP, and then PHP in the traversal package into zip.
Php

$imagee = $_GET['pic'];    foreach ($imagee as $k => $v) {     $image[]= array(            'image_src'  =>$v,            'image_name' => mt_rand(1, 1111) . '.jpg'        );    }

Originally wanted to get the specified src by JS
Js

Discovery output is a piece of data, PHP does not know how to write loops
Can you help me see
Gets the picture address of the specified class and passes it to the background Phpzip package

Reply content:

Maybe my train of thought is not good, to do is a multi-select picture, click on the Auto Pack zip, and then in the download.
Zip already has, PHP does not understand, on the front end made a form get multiple picture address to PHP, and then PHP in the traversal package into zip.
Php

$imagee = $_GET['pic'];    foreach ($imagee as $k => $v) {     $image[]= array(            'image_src'  =>$v,            'image_name' => mt_rand(1, 1111) . '.jpg'        );    }

Originally wanted to get the specified src by JS
Js

Discovery output is a piece of data, PHP does not know how to write loops
Can you help me see
Gets the picture address of the specified class and passes it to the background Phpzip package

$imagee = $_GET['pic'];    foreach ($imagee as $k => $v) {     $image[]= array(            'image_src'  =>$v,            'image_name' => mt_rand(1, 1111) . '.jpg'        );    }我看你这段代码感觉你上传的变量就是一个$_GET['pic'],所以你在前端很可能提交的是一张图片还不是一段图片吧。如果你要提交一组图片,可能参考下下面的方式:1。这样在后台$_GET['pic']得到的就是一个数组了,可以遍历了。2。使用js把前台选中的图片地址,json化,然后赋值给再提交表单,或者直接js提交表单。
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.