預設是無法直接由網站寄信的
可以先查看設定值
必要時可檢查與恢復postfix相關權限
# /etc/init.d/postfix stop
# chgrp postdrop /usr/sbin/postqueue
# chgrp postdrop /usr/sbin/postdrop
# chmod g+s /usr/sbin/postqueue
# chmod g+s /usr/sbin/postdrop
# /etc/init.d/postfix start
SELECT * FROM `users` WHERE `user_name` = '$name' AND `passwd` = '$passwd';
//mysql:host=localhost;dbname=db,name,pw
$dbh = new PDO($dbType.":host=".$hostname.";dbname=".$database, $username, $password);
//attribute請參考 http://www.php.net/manual/en/pdo.getattribute.php
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//set charset
$dbh->query("SET character_set_connection=".$dbcharset.", character_set_results=".$dbcharset.", character_set_client=binary");
$presql = select * from `users` where `user_account` = :user and `user_passwd` = :pass Limit 1;
$stmt = $dbh->prepare($presql);
//http://www.php.net/manual/en/pdostatement.bindparam.php
$stmt->bindParam(":user", "myUserName", "string", 20);
$stmt->bindParam(":pass", "myUserPass", "string", 20);
$result = $stmt->execute(); //return true or false
//fetch type可參考http://www.php.net/manual/en/pdostatement.fetch.php
while( $arr = $stmt->fetch(PDO::FETCH_ASSOC) ){
//do something
}
PDO::__construct() ( string $dsn [, string $username [, string $password [, array $driver_options ]]] )
The Data Source Name, or DSN, contains the information required to connect to the database.
In general, a DSN consists of the PDO driver name, followed by a colon, followed by the PDO driver-specific connection syntax. Further information is available from the PDO driver-specific documentation.
dsn = mysql:host=localhost;dbname=db
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Prepares an SQL statement to be executed by the PDOStatement::execute() method. The SQL statement can contain zero or more named (:name) or question mark (?) parameter markers for which real values will be substituted when the statement is executed.
bindParam(":user", "myUserName", "string", 20);
$hours_diff = strtotime("20:00:00")-strtotime("19:00:00");
echo "". date('h:i', $hours_diff);
官方網站:
http://digitarald.de/project/fancyupload/
這兩天使用時
突然發現會出現error
上官網看了一下
原來是Flash Player 10在搞鬼
(參考這篇:http://digitarald.de/journal/54706744/fancyupload-for-flash-10/)
經過更新後又可以使用了
不過新版本好像有些許bug
就等待作者更新了
The appropriate header can also be set in server side scripting languages. For example:
Perl. Output the correct header before any part of the actual page. After the last header, use a double linebreak, e.g.:print "Content-Type: text/html; charset=utf-8\n\n";
Python. Use the same solution as for Perl (except that you don't need a semicolon at the end).
PHP. Use the header() function before generating any content, e.g.: header('Content-type: text/html; charset=utf-8');
Java Servlets. Use the setContentType method on the ServletResponse before obtaining any object (Stream or Writer) used for output, e.g.:resource.setContentType ("text/html;charset=utf-8");
If you use a Writer, the Servlet automatically takes care of the conversion from Java Strings to the encoding selected.
JSP. Use the page
directive e.g.: <%@ page contentType="text/html; charset=UTF-8" %>
Output from out.println()
or the expression elements (<%= object
%>
) is automatically converted to the encoding selected. Also, the page itself is interpreted as being in this encoding.
ASP and ASP.Net. content type and charset are set independently, and are methods on the response object. To set the charset, use e.g.: <%Response.charset="utf-8"%>
In ASP.Net, setting Response.ContentEncoding will take care both of the charset parameter in the HTTP Content-Type as well as of the actual encoding of the document sent out (which of course have to be the same). The default can be set in the globalization
element in Web.config
(or Machine.config
, which is originally set to UTF-8).
現時用 PHP 編寫上傳檔案的功能時,如果檔案體積較龐大,或者使用者與伺服器端的連線較慢,這樣上傳便要等一段頗長的時間,而且最慘是使用者根本不知還要等多久,以及已經上傳進度完成了多少。幸好在 PHP 5.2 支援檢查檔案上傳進度的功能,可以給使用者看到實時上傳進度。這篇在 IBM DeveloperWorks 的文章介紹了用 $_POST 陣及 APC_UPLOAD_PROGRESS 製作上傳實時進度的方法:
What's new in PHP V5.2, Part 5: Tracking file upload progress
轉貼自http://www.real-blog.com/programming/387
找個時間來玩玩@@
加入ExtJS效果會更好
mail("herbjoyce@gmail.com",$sub,$mail_content,$from)
即可完整顯示utf-8標題+內容
<?php //設定產生幾個字 //設定SESSION給check.php做檢查 |