2013年4月11日 星期四

input加入灰色提示文字

<input type='text' name='e_title' size='40' style="color:#999999" value='請填入含年度的考古題標題' onfocus="if (this.value=='請填入含年度的考古題標題') this.value='';this.style.color='#000';" onblur="if (this.value==''){this.value='請填入含年度的考古題標題';this.style.color='#999';}">(範例:<b>一零一學年度碩士班招生考試試題 </b>)<br>

pci簡單通訊控制器 是什麼?

在灌筆電時,這個東西一直找不到適當的驅動來使用。

只好有請狗歌大大了。

這篇有提到:
http://www.mobile01.com/topicdetail.php?f=514&t=1865568

原來是要灌intel的東西
https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=18532&ProdId=3150&lang=eng

2013年4月9日 星期二

ini_set error 、DIRECTORY_SEPARATOR

設定php發生錯誤的等級
ini_set('error_reporting', E_ALL);

ConstantDescriptionNote
E_NOTICERun-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.
E_STRICTEnable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code.Since PHP 5 but not included in E_ALL until PHP 5.4.0
E_ALLAll errors and warnings, as supported, except of level E_STRICT prior to PHP 5.4.0.


ini_set('error_reporting', E_ALL);
ini_set('track_errors', '1');
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');

DIRECTORY_SEPARATOR

DIRECTORY_SEPARATOR是php的內部常量,用於顯示系統分隔符的命令,不需要任何定義與包含即可直接使用。在windows下路徑分隔符是\(當然/在部分系統上也是可以正常運行的),在linux上路徑的分隔符是/,這就導致了一個問題,比如伺服器是windows,有一個圖片上傳程序,伺服器上指定的上傳文件保存目錄是define('ROOT', dirname(__FILE__)."/upload");

於是php引入了DIRECTORY_SEPARATOR變量,可以將上面的寫法改寫为:
define('ROOT', dirname(__FILE__).DIRECTORY_SEPARATOR."upload");

引申閱讀:


  1.     上傳圖片
  2.    上傳檔案簡易版

2013年4月2日 星期二

HTML5 取代部份javascript

javascript 一載入就停駐在頁數(focus)

Javascript+HTML:
書名:<input type="text" name="a" id="a"/><br/>
頁數:<input type="text" name="b" id="b"/>
<script type="text/javascript">
 document.getElementById("b").focus();
</script>
HTML5:(並非所有的瀏覽器都支援)可支援:IE9、chrome
在頁數的input加入autofocus
書名:<input type=text name=a /><br/>
頁數:<input type=text autofocus name=b />

sort 數字和非數字

資料需要鍵入一個值當成資料的排序,使用非數字依然是沒什麼問題。
可是當要用來更改排序時,比大小就會出現狀況,可能會有多個值是會被符合的。

比如說,我要把比5大的sort都加1,那比5大的會有哪些呢? 這就是一個問題。

2013年3月26日 星期二

ckeditor 4.1 範例

<!DOCTYPE html>
<html>
<head>
<title> 路上線上預約系統-編輯借用路邊及垃圾使用規則</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="ckeditor/ckeditor.js"></script>
<link rel="stylesheet" href="ckeditor/contents.css">
</head>


<form action='comm.php?method=up_rule' method='post'>
<textarea class="ckeditor" cols="60" id="editor1" name="editor1" rows="10">
<?php echo $data['rule']; ?>
</textarea>
<input type='hidden' name='op' value='edit'>
<input type='submit' value='更新規則'>
</form>
<input type="button" onclick="doClose()" value="關閉此頁面"/>




</body>
</html>



補充:HTML5 起始1

用到上傳圖片功能的 config.js

CKEDITOR.editorConfig = function( config ) {
 // Define changes to default configuration here. For example:
 // config.language = 'fr';
  config.uiColor = '#AADC6E';
  
 config.toolbar = [
    ['Bold','Italic','Underline','Strike','-'],
    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    ['Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],

    ['TextColor','BGColor','Maximize','ShowBlock'], ['Link','Unlink','Anchor','Table','HorizontalRule'],'/',['Styles','Format','Font','FontSize','Source','Image']
    ];
 config.filebrowserImageUploadUrl = '../../script/ckeditor4.1/upload1.php?type=img';

};
upload1.php(上傳圖片用的程式)
<?php

$config=array();

$config['type']=array("flash","img"); //上傳允許type值

$config['img']=array("jpg","bmp","gif","png"); //img允許后綴
$config['flash']=array("flv","swf"); //flash允許后綴

$config['flash_size']=200; //上傳flash大小上限 單位:KB
$config['img_size']=2000; //上傳img大小上限 單位:KB 

//$config['message']="上傳成功"; //上傳成功后顯示的消息,若為空則不顯示

$config['name']=mktime(); //上傳后的文件命名規則 這里以unix時間戳來命名




$config['img_dir']="uploadtpd/img"; //上傳img文件地址
$config['site_url']="http://XXXXX/coledXX/tpd/"; //網站的網址 這與圖片上傳后的地址有關 最后不加"/" 可留空
//在上傳圖片後會在URL會用到,並寫到資料庫裡去。
//文件上傳
uploadfile();

function uploadfile()
{
global $config;
//判斷是否是非法調用
if(empty($_GET['CKEditorFuncNum']))
   mkhtml(1,"","錯誤的功能調用請求4");
$fn=$_GET['CKEditorFuncNum'];
if(!in_array($_GET['type'],$config['type']))
   mkhtml(1,"","錯誤的文件調用請求3");
$type=$_GET['type'];
if(is_uploaded_file($_FILES['upload']['tmp_name']))
{
   //判斷上傳文件是否允許
   $filearr=pathinfo($_FILES['upload']['name']);
   $filetype=$filearr["extension"];
   if(!in_array($filetype,$config[$type]))
    mkhtml($fn,"","錯誤的文件類型!2");
   //判斷文件大小是否符合要求
   if($_FILES['upload']['size']>$config[$type."_size"]*1024)
    mkhtml($fn,"","上傳的文件不能超過".$config[$type."_size"]."KB!");
   //$filearr=explode(".",$_FILES['upload']['name']);
   //$filetype=$filearr[count($filearr)-1];
   //$file_abso=$config[$type."_dir"]."/".$config['name'].".".$filetype;
    $file_abso=$config[$type."_dir"]."/".$config['name'].".".$filetype;  //資料夾和檔案路徑
 //echo $file_abso;
 //exit;
  // $file_host=$_SERVER['DOCUMENT_ROOT'].$file_abso;  //絕對路徑
   $file_host="../../../".$config[$type."_dir"]."/".$config['name'].".".$filetype;  //相對路徑
   // echo $file_host;
 //exit;
  
 
   if(move_uploaded_file($_FILES['upload']['tmp_name'],$file_host))
   {
    mkhtml($fn,$config['site_url'].$file_abso,$config['message']);
   }
   else
   {
    mkhtml($fn,"","文件上傳失敗,請檢查上傳目錄設置和目錄讀寫權限");
   }
}
}
//輸出js調用
function mkhtml($fn,$fileurl,$message)
{
$str='<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction('.$fn.', \''.$fileurl.'\', \''.$message.'\');</script>';
exit($str);
}
?>

補充說明:陣列,檔案操作
QA
抓BUG抓不出來,面版一直是最簡單的。
最後把tpd/tpdadmin/script/4.1丟上 社x院即成。

RSS建置

參考:
http://fxc86.blog.hexun.com.tw/26158783_d.html
FeedCreator.class.php

如果你的文章中有中文,生成的 RSS Feed 都會是亂碼,並且時間也和實際不相符或者顯示為一個 1970-01-01 值,
這是由於未設置正確編碼方式時區所造成的。

搜索源碼中的所有 var $encoding = “ISO-8859-1″,將編碼格式改為 utf-8;
搜索 define(”TIME_ZONE”,”+01:00″) 改為 空值其它時區格式,並且在給
RSS 條目賦時間時用 strtotime() 函數將日期字符串轉換為時間格式,這樣就不會造成顯示 1970 年的問題。
目前是使用+8000

原網站:http://www.bitfolge.de/index.php?option=com_content&view=article&id=67:feedcreator&catid=38:eigene&Itemid=59

收費RSS http://feedity.com/

目前RSS規範的主要版本有0.91、1.0和2.0等。
0.91版和1.0版完全不同,風格不同,制定標準的人也不同。0.91版和2.0版一脈相承。
1.0版更接近XML標準。目前世界上大多數知名,雖有很多種不同的RSS,但都定型於兩個重要的支幹(RDF和2.*)。

RDF或RSS 1.*的分支包括下列版本:
RSS 0.90原本屬於美國網景公司的版本。這個RSS被稱為RDF Site Summary,但其基礎構圖建立在初期的RDF規格上,以及和末版的RDF推薦標準不相容。
RSS 1.0是一個開放式的版本,由RSS-DEV工作團隊再次建立為RDF Site Summary。
RSS 1.0是一個像RSS 0.90的RDF形式,但是並沒有完全的和他相容,自從1.0基新聞網站都提供RSS訂閱支援。

變更了 rss.class的程式碼
http://www.phpernote.com/php-function/632.html


驗證 RSS的網站
http://validator.w3.org/feed/

更改class
原先:
$feed.= " <lastbuilddate>".htmlspecialchars($now->rfc822())."</lastBuildDate>\n";
更改為:
$feed.= " <pubdate>".htmlspecialchars($now->rfc822())."</pubDate>\n";

同場加映:
網頁設計.愛上jQuery(附光碟)
TQC+網頁程式設計認證指南HTML5 (附光碟)
別再說你不懂HTML5:圖解網頁設計必學的9堂課

2013年3月25日 星期一

jquery 應用





html

<form >
<table >
<caption><b>處理功能</b></caption>
<tr><th width='100px'>是否接受預約?</th>   <td><input type='radio' name='f_ok' id='f_ok' value='ok'>准許

<input type='radio' name='f_ok' id='f_no' value='no'>不准許
<div id='f_noarea' style='margin-left:20px'>
<input type='checkbox' name='a1' id='a1' class='checkNo' value='同時段XXX。'>同時段如有二位以上預約者時,XXXxxxXXX。

<input type='checkbox' name='a2' id='a2' class='checkNo' value='預約人XXXxxXXX。'>預約人XXXxxXXX。

<input type='checkbox' name='a3' id='a3' class='checkNo' value='不外借XXXxxXXX'>不外借XXXxxXXX。

<input type='checkbox' name='a4' id='a4' class='checkNo'>其他<input type='text' size='30' name='a4_note'>。

</div>
<input type='submit' value='送出' id='s01'></td></tr>
</table>
</form>

2013年3月24日 星期日

Epson AcuLaser CX16 安裝驅動


驅動連結:https://www.epson.com.tw/CustomerAndDownload/SearchResult/19236fe8-571b-4ca8-b1de-6a07ad7cb1bb
檔案名稱:驅動程式-中文版


TCP/IP 注意事項:安裝時,需注意您的作業系統是32位元的還是64位元的。等到驅動裝好後,會跳出 已完成安裝,屆時請到CX16按右鍵->印表機內容->連接埠底下新增連結埠->選擇HP Standard TCP/IP Port 鍵入 IP 即可完成網路印表機

2013年3月22日 星期五

無線網路 10dbi增益天線

前陣子買了一台 TP-LINK WR941ND Ver 3.1(專為台灣做的版本)

雖然有三支 5dbi的天線,但在客廳的速度不是非常滿意。也有在想是不是要買隻10dbi的天線,一隻不貴,但挺懷疑是不是可以改善速度的問題


以下就是google到的資料,以做為日後購買的依據:

SMA——適合不同品牌的無線路由器/AP/無線PCI網卡。(SMA接頭包括常見的DLINK,NETGEAR,TPLINK,SMC,華碩.等無線路由器/AP.

SMA 、TNC ——適合不同品牌的無線路由器/AP/無線PCI網卡。(SMA接頭包括常見的DLINK,NETGEAR,TPLINK,SMC,華碩.等無線路由器/AP.... ;TNC接頭常見於linksys和CISCO).

無線(2.4GWIFI)信號範圍和距離、網卡或AP功率、兩端天線增益、障礙物都有關。所以在建議大家在選擇天線時,需對自己的使用環境作出分析,需要時可與我們客服聯繫諮詢!

賣家提示:10DB全向天線適合遠距離水準覆蓋(半徑200米以上)。如360度覆蓋一個圖書管大廳,廣場。

注意:發射接收兩端使用相同增益天線時,才會有最佳效果!但實際使用2邊天線不一定相同,所以下表僅為理想狀態,一切以實際的效果為准(還和設備功率,環境情況,干擾等因素有關)。


分享器
802.11g (54Mbps)
802.11b (11Mbps)
802.11n 20MHz頻道寬: 1T1R:75Mbps 2T2R:150Mbps 3T3R:225Mbps
802.11n 40MHz頻道寬: 1T1R:150Mbps 2T2R:300Mbps 3T3R:450Mbps
1-3為天線數量 、R為receive(接收)、T為transmit(傳送)

但手機、平板大多仍為1T1R 20MHz設計
所以即使用了3T3R 40MHz頻道寬的802.11n分享器,
也只能遷就手機、平板天線傳輸,也就是75Mbps

2013年3月19日 星期二

在本機上鎖住網頁,讓工作更有效率

為了讓自己在工作上可以投入更多的心思,決定把某些網站關掉。

怎麼做呢?

路徑:windows→system32→drivers→etc→hosts(用筆記本開啟)



host的內容 參考如下:(詳細的就google囉)

127.0.0.1 localhost
::1 localhost

0.0.0.0 facebook.com
0.0.0.0 www.facebook.com
0.0.0.0 www.youtube.com.tw
0.0.0.0 www.youtube.com






PS.存檔時遇到不能儲存的問題,這時就要把筆記本用 右鍵 系統管理員身份執行
參考這帖 http://tommy.ironman.tw/windows-7-vista-hosts-error/
小紅傘為了保護系統會禁止更改檔案。

申請帳號時,驗證帳號(ID)



HTML













2013年3月16日 星期六

Prestashop 裝好後 發生500的狀況,看不到前台。

裝好後 發生500的狀況,看不到前台。
第一步,把錯誤碼顯示出來:
到Prestashop的ROOT抓config資料夾裡的defines.inc.php 更改define('_PS_MODE_DEV_', false);為define('_PS_MODE_DEV_', true);

第二步,針對錯誤碼做修正:
key word:Fatal Error Allowed memory size of 16777216 bytes exhausted
在defines.inc.php 加入ini_set('memory_limit', -1);


參考:http://www.vbulletin.com/forum/forum/vbulletin-legacy-versions-products/legacy-vbulletin-versions/vbulletin-3-6-questions-problems-and-troubleshooting/247083-help-fatal-error-allowed-memory-size-of-16777216-bytes-exhausted?s=baebb7dcbacc32a6f214729985b5cc20


http://www.youtube.com/watch?v=sFSg0WOvSzg

中文翻譯

http://twpug.net/modules/newbb/viewtopic.php?post_id=26441

2013年3月11日 星期一

IE8 相容性檢視

Q:使用者 切換到ie 的相容性環境,使得版面 跑版

http://audi.tw/Blog/window/IEMode.asp

解決方式:出現提示,讓使用者切回非相容性環境。

同場加映..

2013年3月4日 星期一

css span 排版

<style type="text/css"> 
    .fixed{float:left;width:105px;text-align:right;}
   p{margin:5px;}
   </style>

<p/><span class="fixed">姓名:</span><input name="teacher_name" type="text"  /></p>
<p/><span class="fixed">姓名(english):</span><input name="teacher_ename" type="text"  /></p>
   

2013年2月18日 星期一

上傳檔案簡易版

創建 FILE UPLOAD



Create The Upload Script


if ($_FILES["file"]["error"] > 0){
    echo "Error: " . $_FILES["file"]["error"] . "";
  }else{
    echo "Upload: " . $_FILES["file"]["name"] . "";
    echo "Type: " . $_FILES["file"]["type"] . "";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
  }


$_FILES["file"]["name"] - the name of the uploaded file
$_FILES["file"]["type"] - the type of the uploaded file
$_FILES["file"]["size"] - the size in kilobytes of the uploaded file
$_FILES["file"]["tmp_name"] - the name of the temporary copy of the file stored on the server
$_FILES["file"]["error"] - the error code resulting from the file upload

2013年2月17日 星期日

回到頂端

js:scrolltopcontrol.js
//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09')
//** v1.1 (April 7th, 09'):
//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead.
//** 2) Fixes scroll animation not working in Opera. 

var $j=jQuery.noConflict();
var scrolltotop={
 //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
 //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
 setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
 controlHTML: '', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
 controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
 anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

 state: {isvisible:false, shouldvisible:false},

 scrollup:function(){
  if (!this.cssfixedsupport) //if control is positioned using JavaScript
   this.$control.css({opacity:0}) //hide control immediately after clicking it
  var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
  if (typeof dest=="string" && $j('#'+dest).length==1) //check element set by string exists
   dest=$j('#'+dest).offset().top
  else
   dest=0
  this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
 },

 keepfixed:function(){
  var $window=$j(window)
  var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
  var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
  this.$control.css({left:controlx+'px', top:controly+'px'})
 },

 togglecontrol:function(){
  var scrolltop=$j(window).scrollTop()
  if (!this.cssfixedsupport)
   this.keepfixed()
  this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
  if (this.state.shouldvisible && !this.state.isvisible){
   this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
   this.state.isvisible=true
  }
  else if (this.state.shouldvisible==false && this.state.isvisible){
   this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
   this.state.isvisible=false
  }
 },
 
 init:function(){
  $j(document).ready(function($){
   var mainobj=scrolltotop
   var iebrws=document.all
   mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
   mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
   mainobj.$control=$('
'+mainobj.controlHTML+'
') .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'}) .attr({title:'Scroll Back to Top'}) .click(function(){mainobj.scrollup(); return false}) .appendTo('body') if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text mainobj.togglecontrol() $('a[href="' + mainobj.anchorkeyword +'"]').click(function(){ mainobj.scrollup() return false }) $(window).bind('scroll resize', function(e){ mainobj.togglecontrol() }) }) } } scrolltotop.init()

圖片
UP:
程式碼:

放進去就可以用了。

2013年2月5日 星期二

MAIL OUTLOOK 信中有亂碼(主旨、寄件人、內容)產生

情況:收的人用outlook收信,發現是一團亂碼。



主旨、寄件人 皆比照辦理
$subject = "天氣 ".$state." 可能會...";
添加base64_encode
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
內容:加入html 和charset=utf-8
$message = '


   
   Fillon soutient à fond le retour d\'un Grand Prix de France


   Le Premier ministre François Fillon, passionné d\'automobile et pilote à ses heures, a apporté un soutien appuyé au retour d\'un Grand Prix de France au calendrier 2013 de la Formule 1, en faisant un passage-éclair vendredi sur le circuit Paul Ricard dans le Var.



header
$headers = "MIME-Version: 1.0\r\n";
   $headers .= "Content-type: text/html; charset=utf- 8\r\n";

如果再不見,只好見官方PHP 的MAIL 有前輩提供了一個fuhction..
網址:http://www.php.net/manual/en/function.mail.php#92976
/*
 **
 * Function responsible for sending unicode emails.
 *
 * @author Gajus Kuizinas 
 * @version 1.0.1 (2012 01 11)
 */
function mail_send($arr)
{
    if (!isset($arr['to_email'], $arr['from_email'], $arr['subject'], $arr['message'])) {
        throw new HelperException('mail(); not all parameters provided.');
    }
    
    $to            = empty($arr['to_name']) ? $arr['to_email'] : '"' . mb_encode_mimeheader($arr['to_name']) . '" <' . $arr['to_email'] . '>';
    $from        = empty($arr['from_name']) ? $arr['from_email'] : '"' . mb_encode_mimeheader($arr['from_name']) . '" <' . $arr['from_email'] . '>';
    
    $headers    = array
    (
        'MIME-Version: 1.0',
        'Content-Type: text/html; charset="UTF-8";',
        'Content-Transfer-Encoding: 7bit',
        'Date: ' . date('r', $_SERVER['REQUEST_TIME']),
        'Message-ID: <' . $_SERVER['REQUEST_TIME'] . md5($_SERVER['REQUEST_TIME']) . '@' . $_SERVER['SERVER_NAME'] . '>',
        'From: ' . $from,
        'Reply-To: ' . $from,
        'Return-Path: ' . $from,
        'X-Mailer: PHP v' . phpversion(),
        'X-Originating-IP: ' . $_SERVER['SERVER_ADDR'],
    );
    
    mail($to, '=?UTF-8?B?' . base64_encode($arr['subject']) . '?=', $arr['message'], implode("\n", $headers));
}

2013.05.17 新增
因為寄件人亂碼了,所以做了變化,不知道有沒有成功。
function mail_send($arr)
{
    if (!isset($arr['to_email'], $arr['from_email'], $arr['subject'], $arr['message'])) {
        throw new HelperException('mail(); not all parameters provided.');
    }
    
    $to            = empty($arr['to_name']) ? $arr['to_email'] : '"' . mb_encode_mimeheader($arr['to_name']) . '" <' . $arr['to_email'] . '>';

 //針對寄件人的姓名做DEBUG避免寄件人姓名亂碼
    $from        = empty($arr['from_name']) ? $arr['from_email'] : '"' .'=?UTF-8?B?' . base64_encode( mb_encode_mimeheader($arr['from_name'])) . '?=' . '" <' . $arr['from_email'] . '>';
    $headers    = array
    (
        'MIME-Version: 1.0',
        'Content-Type: text/html; charset="UTF-8";',
        'Content-Transfer-Encoding: 7bit',
        'Date: ' . date('r', $_SERVER['REQUEST_TIME']),
        'Message-ID: <' . $_SERVER['REQUEST_TIME'] . md5($_SERVER['REQUEST_TIME']) . '@' . $_SERVER['SERVER_NAME'] . '>',
        'From: ' . $from,
        'Reply-To: ' . $from,
        'Return-Path: ' . $from,
        'X-Mailer: PHP v' . phpversion(),
        'X-Originating-IP: ' . $_SERVER['SERVER_ADDR'],
    );
    
    mail($to, '=?UTF-8?B?' . base64_encode($arr['subject']) . '?=', $arr['message'], implode("\n", $headers));
}

base64_encode 解釋:

Encodes the given data with base64.
This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
Base64-encoded data takes about 33% more space than the original data.

參考連結:

php mail 寄送會有亂碼: 解決方式如下:
http://www.macsoho.net/blog/?p=143
http://www.php.net/manual/en/function.mail.php#92976

參考:
  1. PHPMailer - PHP email class

2013年1月28日 星期一

HTML FORM 中 使用屬性 disabled readonly , submit丟出去的處理狀況


readonly只能用在 屬性input裡面。form送出去後的name value是可以被使用的。
disalbed=>select,input 都可以使用,但form送出後的name value是不可以被使用的。

Q:目前是想把select在按下 "確認資料"成功後是不能被更變的

A:目前是想把select在按下 "確認資料"成功後是不能被更變的,但readly 卻不能使用在select上面,
為了讓select不能被更變,只好使用disalbed,但form送出去,disabled的值是不能使用的,只好在form底下
設一個hidden的input 底下的name 跟 select 的name是相同的。

當按下 input type submit(確認資料)後 select被jquery 設了disalbed。

記得在form底碼 加一個跟select 相同ID 的 input hidden 並指定selected 的value。
這樣就可以處理這件事了。

2012年11月2日 星期五

[文章標題]在近N天的標題後加一個new的icon

function new_image($s_time){
  $tc=(date('U',time())-date("U",strtotime($s_time)))/86400;
  $tc_image_new='';
 if($tc<=3)
  $tc_image_new="";
      
  return $tc_image_new;
}

PS. 一天86400秒

icon finder: http://www.iconfinder.com/

您可能有興趣的書單: