本文整理汇总了PHP中CSV::fromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CSV::fromArray方法的具体用法?PHP CSV::fromArray怎么用?PHP CSV::fromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSV
的用法示例。
在下文中一共展示了CSV::fromArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
public function generate()
{
$reportManager = new ReportManager(Input::all());
$report = $reportManager->generate();
$dateTime = new DateTime('NOw');
return CSV::fromArray($report)->setHeaderRowExists(false)->render('Reporte_' . Input::get('report', '') . '_' . $dateTime->getTimestamp() . '.csv');
}
示例2: getViewAllMember
/**
* This function responses to
* the get request of /admin/member
* and show all member as list
*/
public function getViewAllMember($msg = null)
{
if (!empty($msg) && $msg == 1) {
return View::make('adminArea.member.view')->with('members', Member::orderBy('id', 'desc')->get())->with('success', 'Member has been deleted successfully');
}
if (!empty($msg) && $msg == 'csv-for-mailchimp') {
$members = Member::select('first_name', 'last_name', 'email')->get()->toArray();
return CSV::fromArray($members)->render('Members CSV for MailChimp.csv');
}
if (!empty($msg) && $msg == 'csv-for-sms-sender') {
$members = Member::select('mobile_no')->get()->toArray();
return CSV::fromArray($members)->render('Members CSV for SMS Sender.csv');
}
return View::make('adminArea.member.view')->with('members', Member::orderBy('id', 'desc')->get());
}