1 2 3 4 5 6 |
<?php $counter_file = 'aa.txt ';//文件名及路径,在当前目录下新建aa.txt文件 $fopen = fopen($counter_file, 'wb ');//新建文件命令 fputs($fopen, 'aaaaaa ');//向文件中写入内容; fclose($fopen); ?> |
1 2 3 4 5 6 |
<?php $counter_file = 'aa.txt ';//文件名及路径,在当前目录下新建aa.txt文件 $fopen = fopen($counter_file, 'wb ');//新建文件命令 fputs($fopen, 'aaaaaa ');//向文件中写入内容; fclose($fopen); ?> |
1 2 3 4 5 6 7 8 9 10 11 |
function deletehtml($str) { $str = trim($str); $str=strip_tags($str,""); $str=preg_replace("{\t}","",$str); $str=preg_replace("{\r\n}","",$str); $str=preg_replace("{\r}","",$str); $str=preg_replace("{\n}","",$str); $str=preg_replace("{ }","",$str); return $str; } |
因在开发中需要经常修改,从而要经常删除缓存,才能看到效果。 所以为了开发的方便,可以把缓存给去除。 1.找到\…
1.下载官方有例子的包,然后找到例子下面的Page例子。 2. 找到Page.class.php,复制到你自己…
http://www.iteye.com/topic/409525 [crayon-68901989777ca…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
public String createZip(String zipFileName,List<String> fileList,String speSymbols){ ZipOutputStream out = null; File zipFile = new File(zipFileName); try { if(!zipFile.exists()){ zipFile.createNewFile(); }else{ zipFile.delete(); zipFile.createNewFile(); } out = new ZipOutputStream(new FileOutputStream(zipFile)); for(String filePath: fileList){ File file = new File(filePath); ZipEntry ent = new ZipEntry(file.getName()); FileInputStream ins = new FileInputStream (file); out.putNextEntry(ent); int b = 0; while((b=ins.read())!=-1){ out.write(b); } ins.close(); } out.close(); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return null; } |
ThinkPHP Ajax for JQuery A: [crayon-6890198977b76580892…
http://hi.baidu.com/mengqingaaa/blog/item/d294283dd3aad…
1:
1 2 3 4 5 6 7 8 9 10 |
function isEmptyDir( $path ) { $dh= opendir( $path ); while(false !== ($f = readdir($dh))) { if($f != ". " && $f != ".. " ) return true; } return false; } |
2: [crayon-68901989…
http://hi.baidu.com/get52/blog/item/56f4d80336bf8ee208f…
http://it.oyksoft.com/post/49/ [crayon-6890198977ecd118…
http://hi.baidu.com/ken00821/blog/item/6a4cf8d48dc7a4ce…
http://www.w3school.com.cn/php/php_file_upload.asp 创建一个…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
function PMA_getenv($var_name) { if (isset ( $_SERVER [$var_name] )) { return $_SERVER [$var_name]; } elseif (isset ( $_ENV [$var_name] )) { return $_ENV [$var_name]; } elseif (getenv ( $var_name )) { return getenv ( $var_name ); } elseif (function_exists ( 'apache_getenv' ) && apache_getenv ( $var_name, true )) { return apache_getenv ( $var_name, true ); } return ''; } if (empty ( $HTTP_HOST )) { if (PMA_getenv ( 'HTTP_HOST' )) { $HTTP_HOST = PMA_getenv ( 'HTTP_HOST' ); } else { $HTTP_HOST = ''; } } //echo htmlspecialchars($HTTP_HOST ); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
function listFile($dir) { $fileArray = array(); $cFileNameArray = array(); if($handle = opendir($dir)) { while(($file = readdir($handle)) !== false) { if($file !="." && $file !="..") { if(is_dir($dir."\\".$file)) { $cFileNameArray = listFile($dir."\\".$file); for($i=0;$i<count($cFileNameArray);$i++) { $fileArray[] = $cFileNameArray[$i]; } } else { $fileArray[] = $file; } } } return $fileArray; } else { echo "111"; } } $aaa = listFile("E:\java chm"); var_dump($aaa); |
php遍历文件夹(获得文件名)
http://blog.sina.com.cn/s/blog_541f0d350100e1pz.html PH…
http://www.java3z.com/cwbwebhome/article/article5/51290…
http://blog.csdn.net/yishiyichen/article/details/577518…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
function onError($errCode, $errMesg, $errFile, $errLine) { echo "Error Occurred\n"; throw new Exception($errMesg); } function onException($e) { echo $e->getMessage(); } set_error_handler("onError"); set_exception_handler("onException"); try { $mm=0/0; echo $mm; } catch (Exception $e) { echo $e->getCode()."\n"; echo $e->getMessage()."\n"; } |
一定要定义和调用 set_error_han…
详解:http://www.phpweblog.net/jarryyip/archive/2008/05/11…
http://www.phpweblog.net/kiyone/archive/2007/07/04/1432…
方法一:使用PHP自带函数 Header(“Location:网址”); 说明:必须在…
1 2 3 4 5 6 7 8 9 |
$action=$HTTP_POST_VARS["Button1"]; if($action=="提交") { //执行表单操作 } else { //读取默认值 } |
本篇文章来源于 永余PHP开源技术社区 | …
参考 Java代码 http://www.java3z.com/cwbwebhome/article/arti…
java为数据结构中的映射定义了一个接口java.util.Map;它有四个实现类,分别是HashMap Ha…
注意: 下面的配置不是拦截Controller的, 拦截Controller的需要在servlet.xml, …
参考: http://www.blogjava.net/liuwentao253/archive/2007/0…
http://blog.csdn.net/liuzhenwen/article/details/3938883
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
package com.app; import java.io.Serializable; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.MissingResourceException; import java.util.ResourceBundle; import org.apache.commons.lang.StringUtils; public class MessageUtils implements Serializable{ /** * @param args */ private static String locale; private static ResourceBundle bind; private static String baseName; public static String getBaseName() { return baseName; } public static void setBaseName(String baseName) { MessageUtils.baseName = baseName; bind = null; } public static String getMessage(String key){ String message = null; try { message = getBind().getString(key); } catch (MissingResourceException e) { return "@@ Not found message for key="+key; } if(StringUtils.isBlank(message)) return "@@ Not found message for key="+key; return message; } public static String getMessage(String key,Map<String,String> values){ String message = null; try { message = getBind().getString(key); } catch (MissingResourceException e) { return "@@ Not found message for key="+key; } if(StringUtils.isBlank(message)) return "@@ Not found message for key="+key; if(values==null) return message; Iterator it = values.keySet().iterator(); while(it.hasNext()){ String paraName = it.next().toString(); key.replaceAll("{"+paraName+"}", values.get(paraName).toString()); } return message; } public static String getMessage(String key,String[] values){ String message = null; try { message = getBind().getString(key); } catch (MissingResourceException e) { return "@@ Not found message for key="+key; } if(StringUtils.isBlank(message)) return "@@ Not found message for key="+key; if(values==null||values.length==0) return message; for(int i=0; i<values.length; i++){ key.replaceAll("{"+i+"}", values[i]); } return message; } public static String getMessage(String key,List<String> values){ String message = null; try { message = getBind().getString(key); } catch (MissingResourceException e) { return "@@ Not found message for key="+key; } if(StringUtils.isBlank(message)) return "@@ Not found message for key="+key; if(values==null||values.size()==0) return message; for(int i=0; i<values.size(); i++){ key.replaceAll("{"+i+"}", values.get(i)); } return message; } public String getLocale() { return locale; } public void setLocale(String locale) { this.locale = locale; } private static ResourceBundle getBind() { if(baseName==null) baseName = "locale.message"; if (bind == null) { if (locale == null || locale.equals("")) //src/locale/message.properties bind = ResourceBundle.getBundle(baseName); else bind = ResourceBundle.getBundle(baseName + locale); } return bind; } public void setBind(ResourceBundle bind) { this.bind = bind; } public void reset(){ bind = null; baseName = null; } public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(MessageUtils.getMessage("com.s2s3h3.app.testMessage",new String[]{"aaa","bbb"})); MessageUtils.setBaseName("struts"); System.out.println(MessageUtils.getMessage("struts.login.pageName")); } } |
解决办法 1: http://blog.sina.com.cn/s/blog_4bb5650c01007t2f…
1 2 3 |
JLabel jlabel = new JLabel(test_str); FontMetrics fm = jlabel.getFontMetrics(new java.awt.Font("Times New Roman",java.awt.Font.PLAIN, 12)); System.out.println("string width="+fm.stringWidth(test_str)); |
1 |
sheet.getRowView(0).getDimension() |
这一段代码就是读取行高度。 我现在要放一段数…
http://news.qiku.info/blog/3702.html 让XXXAction类实现Prepa…
Display Tag Lib 显示表格标签 display:table class=”its&#…
http://xieruilin.iteye.com/blog/716031 [crayon-68901989…