Test.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Heanup\App\Api\Controller;
  3. use Heanup\App\Api\Config\Code;
  4. use Heanup\App\Api\Controller;
  5. use Heanup\App\Api\Package\Database\Num;
  6. use Heanup\Library\Sms\ReceiveSmsCc;
  7. class Test extends Controller
  8. {
  9. protected function main()
  10. {
  11. $lib = new ReceiveSmsCc();
  12. $data = $lib->getCountry();
  13. $config=Code::getData();
  14. $result=[];
  15. foreach ($data as &$item) {
  16. $pic_name = substr($item['img'], strrpos($item['img'], "/") + 1);
  17. if (!file_exists(APP_DIR . '/public/api/flag/' . $pic_name)){
  18. file_put_contents(APP_DIR . '/public/api/flag/' . $pic_name, file_get_contents($item['img']));
  19. }
  20. $item['img']="/flag/".$pic_name;
  21. $result[$item['country']]=$config[$item['country']];
  22. $result[$item['country']]['flag']=$item['img'];
  23. // $this->showSuccess($nums);
  24. }
  25. // $this->showSuccess($config);
  26. // $this->showSuccess($result);
  27. echo var_export($result);
  28. }
  29. }