Kamis, 17 Oktober 2013

PHP Indonesia - Facebook: header("Content-Type: application/vnd.ms-excel"); ...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
Manage your social media

Best social media tool for image publishing to Facebook and Twitter. Look amazing and delight your followers. Get 40% off when you sign up today.
From our sponsors
header("Content-Type: application/vnd.ms-excel"); ...
Oct 17th 2013, 06:59, by Nurul Laily

Nurul Laily 6:59am Oct 17
header("Content-Type: application/vnd.ms-excel");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=contoh-pegawai.xls");//ganti nama sesuai keperluan
header("Pragma: no-cache");
header("Expires: 0");

mau bikin laporan ke excel tapi malah keluar warning kaya gini :
Warning: Cannot modify header information - headers already sent by...

dibantu ya mas2 :(

Awan Nawa 7:03am Oct 17
header("Content-Type: application/vnd.ms-excel");
header("Content-type: application/octet-stream");
kok dobel mbak

Ricky Wisnadri S. Kom 7:07am Oct 17
contoh1
<?php
header("Content-Type: application/vnd.ms-excel");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=contoh-pegawai.xls");//ganti nama sesuai keperluan
header("Pragma: no-cache");
header("Expires: 0");

Mesti ditaro seperti itu,jangan ada sesuatu di atas statement header yang mengakibatkan seolah-olah header dikirim.

contoh2
<?php
echo "1";
header("Content-Type: application/vnd.ms-excel");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=contoh-pegawai.xls");//ganti nama sesuai keperluan
header("Pragma: no-cache");
header("Expires: 0");

Contoh2 adalah keliru

contoh3.1
<html>
<?php
header("Content-Type: application/vnd.ms-excel");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=contoh-pegawai.xls");//ganti nama sesuai keperluan
header("Pragma: no-cache");
header("Expires: 0");
------------
contoh3.2
[spasi]
<?php
header("Content-Type: application/vnd.ms-excel");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=contoh-pegawai.xls");//ganti nama sesuai keperluan
header("Pragma: no-cache");
header("Expires: 0");

Contoh3.x diatas juga keliru karena header sudah terbuat dengan bentuk contoh3.x diatas

Nurul Laily 7:10am Oct 17
oh sama aja ya? harusnya gimana mas Awan?

Ricky Wisnadri S. Kom 7:10am Oct 17
contoh4
<?php
if(true)
{
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=contoh-pegawai.xls");//ganti nama sesuai keperluan
header("Pragma: no-cache");
header("Expires: 0");
}

contoh diatas betul ketika menggunakan header, karena belum ada command yang semisal echo atau yang menghasilkan sesuatu yang di cetak di browser.

Nurul Laily 7:17am Oct 17
saya kan pake dreamweaver jadi default udah kepasang tag html di editor... mmmmm gitu ya.. ilmu baru lagi.. makasih banyak ya mas Ricky Wisnadri S. Kom ^_^

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar