csv.php 719 B

1234567891011121314151617181920212223
  1. <?
  2. $y = date("Y")*1;
  3. $d = cal_days_in_month(CAL_GREGORIAN, $m, $y);
  4. $m = $m<10?"0$m":$m;
  5. $d = $d<10?"0$d":$d;
  6. $b_date = date("Y-".$m."-01 00:00:00");
  7. $e_date = date("Y-".$m."-".$d." 23:59:59");
  8. $authord = [];
  9. if( $author ){
  10. $authornews = [];
  11. $sql = "select * from `news` WHERE `dt_pub` BETWEEN '".$b_date."' AND '".$e_date."' and `news`.active = 'Y' and editors like '$author%' order by dt_pub";
  12. $authord = Yii::$app->db->createCommand( $sql )->queryAll();
  13. }
  14. ?>"Дата";"Заголовок";"URL"
  15. <?
  16. foreach( $authord as $author ){
  17. ?>
  18. "<?=date("d-m-Y h:i", strtotime($author['dt_pub']))?>";"<?=str_replace( '"', "'", ($author['title']))?> "; "https://www.amic.ru/news/<?=$author['id']?>"
  19. <?
  20. }
  21. ?>