This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/8082523/export-records-in-excel-file | |
1. Do query in php to get the rows you want to output | |
2. You can use SELECT * FROM table WHERE id IN (1,2,...) | |
3. Use mysql_fetch_array() or mysql_fetch_assoc() to get the rows one at a time | |
4. Use fputcsv() to output them to a file ending in csv - this will properly escape your data | |
Excel will be able to read the file. | |
Override the defaults for fputcsv to use tabs for delimiters and Excel will have an even easier time reading the file. If you use commas (the default) you may need to pick commas as the delimiter on Excel import. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 1. 显示当前模板文件的路径 | |
// 1. show template file for page | |
// - put in theme functions.php | |
function ey_which_template_is_loaded() { | |
if ( is_super_admin() ) { | |
global $template; | |
print_r( $template ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. 按名字取得网址中的query string | |
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} | |
// example | |
// current URL: http: //www.test.com/index.php?name=John |
OlderNewer