Php 如何通过命令添加保存弹出窗口?我正在以csv格式导出刮取的数据

Php 如何通过命令添加保存弹出窗口?我正在以csv格式导出刮取的数据,php,symfony,web-scraping,command-prompt,export-to-csv,Php,Symfony,Web Scraping,Command Prompt,Export To Csv,我已经用PHP/Symfony编写了一个脚本,它正在抓取web数据并将其保存到CSV文件中。我可以将此CSV文件保存在服务器上的某个文件夹中。但我需要输出到屏幕上,运行它的人选择保存它的位置 class MiscScrapeHistoricalLeaseDataCommand extends ContainerAwareCommand { protected function configure() { parent::configure(); $this->setNam

我已经用PHP/Symfony编写了一个脚本,它正在抓取web数据并将其保存到CSV文件中。我可以将此CSV文件保存在服务器上的某个文件夹中。但我需要输出到屏幕上,运行它的人选择保存它的位置

class MiscScrapeHistoricalLeaseDataCommand extends ContainerAwareCommand {

protected function configure()
{
    parent::configure();
    $this->setName('abc:misc:scrape-lease-data');           
  
}

protected function execute(InputInterface $input, OutputInterface $output)
{   
       // scrapper code
       ...........    
       $this->generateCsv($leaseData);
}

protected function generateCsv($leases = array()) {
       $output = fopen(getcwd().'/web/report.csv', 'w');
       fputcsv($output, array('Address', 'Square Foot', 'Tenant', 'Tenant Representativee', 'Landlord', 'Landlord Representative', 'Notes', 'Issue'));
       fclose($output);
     
} }

  

生成csv报告的下载链接怎么样?现在我只是使用$output=fopen(getcwd()。/web/leaseCSV/report.csv,'w')将导出的csv文件保存在服务器目录中;但是我需要在用户端提供保存和下载文件的选项。我不知道symfony,但您需要为最终用户创建一个链接,以便他可以单击该链接并将其下载到他的计算机谢谢Roeb的建议。。我会按照你的建议尝试。我认为在命令行上提供链接不是可能的解决方案。还有其他选择吗?