我希望每个结果都有自己的唯一网址

时间:2019-11-30 20:04:26

标签: php json

我希望每个结果都有自己的唯一网址,例如:

  

https:/MySite.com/file_code/Interesting-video-title
  https:/MySite.com/file_code/Interesting-video-title

有可能吗?
我的目标是让每个结果都可以出现在Google上!
“ ps:我是代码中的初学者”

   <?php
   error_reporting(0);

   $json = '{ "message": "OK",
       "result": {
           "files": [
               {
                   "code": "FILE_CODE",
                   "id": "FILE_ID",
                   "name": "Interesting video title",
                   "size": "215.7 MB",
                   "uploaded": "2019-11-07"
               },
               {
                   "code": "FILE_CODE",
                   "id": "FILE_ID",
                   "name": "Interesting video title",
                   "size": "215.7 MB",
                   "uploaded": "2019-11-07"
               }
           ],
           "pagination": {
               "current_page": 1,
               "first_page": 1,
               "last_page": 1,
               "next_page": "",
               "previous_page": "",
               "total": 2
           },
           "total": 2
       },
       "success": 1
   }';

   $data_arrays = json_decode($json, true);


   foreach($data_arrays as $data){
       foreach($data['files'] as $result){

           echo "CODE: ".$result['code']."\n";
           echo "ID: ".$result['id']."\n";
           echo "NAME: ".$result['name']."\n";
           echo "SIZE: ".$result['size']."\n";
           echo "UPLOADED: ".$result['uploaded']."\n";
           echo "----------\n";
           #if($results){
           #    echo "<pre>";
           #    print_r($results);
           #}


       }
   }

   ?>

0 个答案:

没有答案