php發送email,php轉發

本文目錄一覽:

php怎麼通過郵件的方式發送一封URL帶參數的地址的郵件?

思想:

通過str_replace來替換掉參數的位置。

類似問題:

小明現在需要發送帶參數$code的url ——”” ,但是直接輸出就是純粹的$code。

解決方法:

僅供參考

//設$content 為郵件內容

$content =  EOF

p align=”center”a href=”Click me to get yoghurt!/abr

/p

EOF;

//設$str 為被替換的字元串

//設$code 為替換字元串,現在要替換掉$content中的”$code”為真正的變數 $code。

$str= ‘$code’;

$code = $_GET[‘code’];

$content = str_replace($str,$code,$content);

//最終就可以實現發送一封URL帶參數郵件的效果了

總結:

此種情況的確比較特殊,但我們平常還是應該多補習一下PHP的函數,在實戰中發揮。

關於我:

MarikoChiba,星雲茶館的站長,歡迎各位的光臨。

如何通過一個php程序給不同的郵箱發送不同的郵件

1.需要一個用來發送電子郵件的文件的程序,也就是一個php文件,流行的phpmail有很多,今天以smtp.php為例演示。

2.將其複製到你的項目文件內,具體路徑根據自己的實際情況,這裡建了一個test文件,用來設置郵件參數,大家也可以自定義郵件參數文件。(PS:一般都是通過表單接受的)

3.smtp.php文件引入。

4.設置郵件參數,具體代碼如下:

//引入發送郵件類

require(“smtp.php”);

$smtpserver = “smtp.163.com”;

$smtpserverport = 25;

//你的163伺服器郵箱賬號

$smtpusermail = “@163.com”;

//收件人郵箱

$smtpemailto = “@qq.com”;

//你的郵箱賬號(去掉@163.com)

$smtpuser = “”;//SMTP伺服器的用戶帳號

//你的郵箱密碼

$smtppass = “”; //SMTP伺服器的用戶密碼

5.設置郵件內容,代碼如下:

//郵件主題

$mailsubject = “測試郵件發送”;

//郵件內容

$mailbody = “PHP+MySQL”;

//郵件格式(HTML/TXT),TXT為文本郵件

$mailtype = “TXT”;

//這裡面的一個true是表示使用身份驗證,否則不使用身份驗證.

$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);

//是否顯示發送的調試信息

$smtp-debug = TRUE;

//發送郵件

$smtp-sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);

刷新頁面後郵件發送,參數不出錯的話1分鐘左右即可發送成功。

至於發幾個人,如何發自己定義下就行

PHP中發送郵件的代碼!

從代碼來看,想必樓主是想把表單提交的內容發送至指定郵箱,而這個郵箱地址也是在表單中填寫的,$sendTo變數的值被賦為表單項「toMail」傳過來的值。

如此,你可以在填寫表單的時候在toMail表單項里填入「88888@qq.com」,或者直接$sendTo=”88888@qq.com”。

接下來就要考慮是否能發送出去了:

1、如果樓主配置的伺服器安裝了sendmail組件,就可以直接使用你寫的這段代碼來完成任務。

2、如果沒有安裝sendmail組件,就要接用smtp伺服器來發送了。這樣相對較複雜,要引用一個PHP類。具體代碼如下:

SMTP.PHP:

?php

class smtp

{

/* Public Variables */

var $smtp_port;

var $time_out;

var $host_name;

var $log_file;

var $relay_host;

var $debug;

var $auth;

var $user;

var $pass;

/* Private Variables */

var $sock;

/* Constractor */

function smtp($relay_host = “”, $smtp_port = 25,$auth = false,$user,$pass)

{

$this-debug = FALSE;

$this-smtp_port = $smtp_port;

$this-relay_host = $relay_host;

$this-time_out = 30; //is used in fsockopen()

#

$this-auth = $auth;//auth

$this-user = $user;

$this-pass = $pass;

#

$this-host_name = “localhost”; //is used in HELO command

$this-log_file = “”;

$this-sock = FALSE;

}

/* Main Function */

function sendmail($to, $from, $subject = “”, $body = “”, $mailtype, $cc = “”, $bcc = “”, $additional_headers = “”)

{

$mail_from = $this-get_address($this-strip_comment($from));

$body = ereg_replace(“(^|(\r\n))(\.)”, “\1.\3”, $body);

$header = “MIME-Version:1.0\r\n”;

if($mailtype==”HTML”)

{

$header .= “Content-Type:text/html\r\n”;

}

$header .= “To: “.$to.”\r\n”;

if ($cc != “”)

{

$header .= “Cc: “.$cc.”\r\n”;

}

$header .= “From: $from”.$from.”\r\n”;

$header .= “Subject: “.$subject.”\r\n”;

$header .= $additional_headers;

$header .= “Date: “.date(“r”).”\r\n”;

$header .= “X-Mailer:By Redhat (PHP/”.phpversion().”)\r\n”;

list($msec, $sec) = explode(” “, microtime());

$header .= “Message-ID: “.date(“YmdHis”, $sec).”.”.($msec*1000000).”.”.$mail_from.”\r\n”;

$TO = explode(“,”, $this-strip_comment($to));

if ($cc != “”)

{

$TO = array_merge($TO, explode(“,”, $this-strip_comment($cc)));

}

if ($bcc != “”)

{

$TO = array_merge($TO, explode(“,”, $this-strip_comment($bcc)));

}

$sent = TRUE;

foreach ($TO as $rcpt_to)

{

$rcpt_to = $this-get_address($rcpt_to);

if (!$this-smtp_sockopen($rcpt_to))

{

$this-log_write(“Error: Cannot send email to “.$rcpt_to.”\n”);

$sent = FALSE;

continue;

}

if ($this-smtp_send($this-host_name, $mail_from, $rcpt_to, $header, $body))

{

$this-log_write(“E-mail has been sent to “.$rcpt_to.”\n”);

}

else

{

$this-log_write(“Error: Cannot send email to “.$rcpt_to.”\n”);

$sent = FALSE;

}

fclose($this-sock);

$this-log_write(“Disconnected from remote host\n”);

}

return $sent;

}

/* Private Functions */

function smtp_send($helo, $from, $to, $header, $body = “”)

{

if (!$this-smtp_putcmd(“HELO”, $helo))

{

return $this-smtp_error(“sending HELO command”);

}

#auth

if($this-auth)

{

if (!$this-smtp_putcmd(“AUTH LOGIN”, base64_encode($this-user)))

{

return $this-smtp_error(“sending HELO command”);

}

if (!$this-smtp_putcmd(“”, base64_encode($this-pass)))

{

return $this-smtp_error(“sending HELO command”);

}

}

#

if (!$this-smtp_putcmd(“MAIL”, “FROM:”.$from.””))

{

return $this-smtp_error(“sending MAIL FROM command”);

}

if (!$this-smtp_putcmd(“RCPT”, “TO:”.$to.””))

{

return $this-smtp_error(“sending RCPT TO command”);

}

if (!$this-smtp_putcmd(“DATA”))

{

return $this-smtp_error(“sending DATA command”);

}

if (!$this-smtp_message($header, $body))

{

return $this-smtp_error(“sending message”);

}

if (!$this-smtp_eom())

{

return $this-smtp_error(“sending CRLF.CRLF [EOM]”);

}

if (!$this-smtp_putcmd(“QUIT”))

{

return $this-smtp_error(“sending QUIT command”);

}

return TRUE;

}

function smtp_sockopen($address)

{

if ($this-relay_host == “”)

{

return $this-smtp_sockopen_mx($address);

}

else

{

return $this-smtp_sockopen_relay();

}

}

function smtp_sockopen_relay()

{

$this-log_write(“Trying to “.$this-relay_host.”:”.$this-smtp_port.”\n”);

$this-sock = @fsockopen($this-relay_host, $this-smtp_port, $errno, $errstr, $this-time_out);

if (!($this-sock $this-smtp_ok()))

{

$this-log_write(“Error: Cannot connenct to relay host “.$this-relay_host.”\n”);

$this-log_write(“Error: “.$errstr.” (“.$errno.”)\n”);

return FALSE;

}

$this-log_write(“Connected to relay host “.$this-relay_host.”\n”);

return TRUE;

}

function smtp_sockopen_mx($address)

{

$domain = ereg_replace(“^.+@([^@]+)$”, “\1”, $address);

if (!@getmxrr($domain, $MXHOSTS))

{

$this-log_write(“Error: Cannot resolve MX \””.$domain.”\”\n”);

return FALSE;

}

foreach ($MXHOSTS as $host)

{

$this-log_write(“Trying to “.$host.”:”.$this-smtp_port.”\n”);

$this-sock = @fsockopen($host, $this-smtp_port, $errno, $errstr, $this-time_out);

if (!($this-sock $this-smtp_ok()))

{

$this-log_write(“Warning: Cannot connect to mx host “.$host.”\n”);

$this-log_write(“Error: “.$errstr.” (“.$errno.”)\n”);

continue;

}

$this-log_write(“Connected to mx host “.$host.”\n”);

return TRUE;

}

$this-log_write(“Error: Cannot connect to any mx hosts (“.implode(“, “, $MXHOSTS).”)\n”);

return FALSE;

}

function smtp_message($header, $body)

{

fputs($this-sock, $header.”\r\n”.$body);

$this-smtp_debug(” “.str_replace(“\r\n”, “\n”.” “, $header.”\n “.$body.”\n “));

return TRUE;

}

function smtp_eom()

{

fputs($this-sock, “\r\n.\r\n”);

$this-smtp_debug(“. [EOM]\n”);

return $this-smtp_ok();

}

function smtp_ok()

{

$response = str_replace(“\r\n”, “”, fgets($this-sock, 512));

$this-smtp_debug($response.”\n”);

if (!ereg(“^[23]”, $response))

{

fputs($this-sock, “QUIT\r\n”);

fgets($this-sock, 512);

$this-log_write(“Error: Remote host returned \””.$response.”\”\n”);

return FALSE;

}

return TRUE;

}

function smtp_putcmd($cmd, $arg = “”)

{

if ($arg != “”)

{

if($cmd==””)

$cmd = $arg;

else

$cmd = $cmd.” “.$arg;

}

fputs($this-sock, $cmd.”\r\n”);

$this-smtp_debug(” “.$cmd.”\n”);

return $this-smtp_ok();

}

function smtp_error($string)

{

$this-log_write(“Error: Error occurred while “.$string.”.\n”);

return FALSE;

}

function log_write($message)

{

$this-smtp_debug($message);

if ($this-log_file == “”)

{

return TRUE;

}

$message = date(“M d H:i:s “).get_current_user().”[“.getmypid().”]: “.$message;

if (!@file_exists($this-log_file) || !($fp = @fopen($this-log_file, “a”)))

{

$this-smtp_debug(“Warning: Cannot open log file \””.$this-log_file.”\”\n”);

return FALSE;

}

flock($fp, LOCK_EX);

fputs($fp, $message);

fclose($fp);

return TRUE;

}

function strip_comment($address)

{

$comment = “\([^()]*\)”;

while (ereg($comment, $address))

{

$address = ereg_replace($comment, “”, $address);

}

return $address;

}

function get_address($address)

{

$address = ereg_replace(“([ \t\r\n])+”, “”, $address);

$address = ereg_replace(“^.*(.+).*$”, “\1”, $address);

return $address;

}

function smtp_debug($message)

{

if ($this-debug)

{

echo $message;

}

}

}

?

DEMO:TEST.PHP

?php

require “smtp.php”;

$smtpserver = “smtp.xxx.com”;//SMTP伺服器

$smtpserverport =25;//SMTP伺服器埠

$smtpusermail = “xxxx@xxx.com”;//SMTP伺服器的用戶郵箱

$smtpemailto = “xxxx@xxx.com”;//發送給誰

$smtpuser = “xxxx”;//SMTP伺服器的用戶帳號

$smtppass = “xxxx”;//SMTP伺服器的用戶密碼

$mailsubject = “客戶反饋意見!”;//郵件主題

$mailbody = “h1這是我的一個測試~~~/h1”;//郵件內容

$mailtype = “HTML”;//郵件格式(HTML/TXT),TXT為文本郵件

$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//這裡面的一個true是表示使用身份驗證,否則不使用身份驗證.

$smtp-debug = false;//是否顯示發送的調試信息

$return = ($smtp-sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype));

echo $return;

?

php發送郵件的問題:php怎麼才能發送郵件呢?使用自帶的函數,應該怎樣設置相應的郵件伺服器?

首先,我不想給phpmailer這個東西做廣告,但是我確實使用的這個東西,很費解。

下載一個phpmailer類,裡面主要的是三個文件class.phpmailer.php\class.pop3.php\class.smtp.php

將這三個文件放到同一個文件夾.eg:papmailer

申請一個網路郵件伺服器(我用的是163伺服器)

編寫發送郵件代碼如下

/**

     * 發送郵件

     * @param unknown_type $sendto_email        接收人Email

     * @param unknown_type $subject                郵件主題

     * @param unknown_type $body                郵件內容

     * @param unknown_type $user_name            接受人姓名

     */

    function send_email( $sendto_email, $subject, $body, $user_name){

        require_once “phpmailer/class.phpmailer.php”; 

        $mail = new PHPMailer();             //創建類對象

        $mail-IsSMTP();                                         

        $mail-Host = “smtp.163.com”;         // SMTP servers 使用163伺服器,郵件smtp伺服器 

        $mail-SMTPAuth = true;               // turn on SMTP authentication 

        $mail-Username = “你申請的163郵箱帳號”;                 // SMTP username 注意:普通郵件認證不需要加 @域名 

        $mail-Password = “163郵箱密碼”;                 // SMTP password 

        $mail-From = “發件人郵箱,可以使用上面163郵箱”;                     // 發件人郵箱 

        $mail-FromName = “發件人名稱,自己隨意命名”;                 // 發件人 

        

        $mail-CharSet = “utf8”;                                // 這裡指定字符集! 

        $mail-Encoding = “base64”; 

        $mail-AddAddress($sendto_email,$user_name);            // 收件人郵箱和姓名 

        $mail-IsHTML(true); // send as HTML 

        // 郵件主題 

        $mail-Subject = $subject; 

        // 郵件內容 

        $mail-Body = $body;

        

        $mail-AltBody =”text/html”; 

        if(!$mail-Send()){ 

            return $mail-ErrorInfo; 

        }else { 

            return true; 

        } 

    }

PHP發送的電郵, hotmail收不到, 怎樣做?

親 我給你份資料,你自己學學 關於 PHPmailer的,這個是燕十八的課,你網上搜搜,他的網站 自學IT網

,不行你就用他的方法 發郵件  真的自己使用socke他純便 指不定就那裡寫錯了,建議你使用PHPMAILER

第一,需要下載PHPMailer文件包phpmailer.

第二,確認你的伺服器系統已經支持socket ,通過phpinfo();查看是否支持sockets(socket 是屬於PHP擴展部分),如果顯現為「enabled」,那就是支持了。

第三,把文件解壓到你的web伺服器目錄下,調用類就可以了.

首先包含class.phpmailer.php,然後創建對象,設置參數,調用成員函數。

例1,做成函數方便調用

複製代碼 代碼如下:

?php   

    require(“phpmailer/class.phpmailer.php”);   

    function smtp_mail( $sendto_email, $subject, $body, $extra_hdrs, $user_name){   

        $mail = new PHPMailer();   

        $mail-IsSMTP();                  // send via SMTP   

        $mail-Host = “200.162.244.66”;   // SMTP servers   

        $mail-SMTPAuth = true;           // turn on SMTP authentication   

        $mail-Username = “yourmail”;     // SMTP username  注意:普通郵件認證不需要加 @域名   

        $mail-Password = “mailPassword”; // SMTP password   

        $mail-From = “yourmail@yourdomain.com”;      // 發件人郵箱   

        $mail-FromName =  “管理員”;  // 發件人   

        $mail-CharSet = “GB2312”;   // 這裡指定字符集!   

        $mail-Encoding = “base64”;   

        $mail-AddAddress($sendto_email,”username”);  // 收件人郵箱和姓名   

        $mail-AddReplyTo(“yourmail@yourdomain.com”,”yourdomain.com”);   

        //$mail-WordWrap = 50; // set word wrap 換行字數   

        //$mail-AddAttachment(“/var/tmp/file.tar.gz”); // attachment 附件   

        //$mail-AddAttachment(“/tmp/image.jpg”, “new.jpg”);   

        $mail-IsHTML(true);  // send as HTML   

        // 郵件主題   

        $mail-Subject = $subject;   

        // 郵件內容   

        $mail-Body = ”  

    htmlhead  

    meta http-equiv=”Content-Language” content=”zh-cn”  

    meta http-equiv=”Content-Type” content=”text/html; charset=GB2312″  

    /head  

    body  

    I love php。  

    /body  

    /html  

    “;                                                                         

        $mail-AltBody =”text/html”;   

        if(!$mail-Send())   

        {   

            echo “郵件發送有誤 p”;   

            echo “郵件錯誤信息: ” . $mail-ErrorInfo;   

            exit;   

        }   

        else {   

            echo “$user_name 郵件發送成功!br /”;   

        }   

    }   

    // 參數說明(發送到, 郵件主題, 郵件內容, 附加信息, 用戶名)   

    smtp_mail(“yourmail@yourdomain.com”, “歡迎使用phpmailer!”, “NULL”, “yourdomain.com”, “username”);   

    ?

注意:

1. 郵件的字符集設置, $mail-CharSet = “GB2312”; // 這裡指定字符集!在這裡我只指定為GB2312因為這樣Outlook能正常顯示郵件主題,我嘗試過設為utf-8但在Outlook下顯示亂碼。

2. 如果是發送html格式的郵件,那麼記得也指定

3. 如果你想用它來群發郵件的話,記得修改包含文件函數,如:

require(“phpmailer/class.phpmailer.php”);

改為

require_once(“phpmailer/class.phpmailer.php”);

否則的話會產生類的重定義。

個人認為要使用phpmailer,首先,需要有一個郵件伺服器,PHP的 mail函數沒有指定,應該是使用的PHP設置的SMTP。

而在這裡需要具體指定,同時需要指定郵件伺服器的管理者和密碼。

PHPMailer 也是一個功能強大的郵件類

PHPMailer的主要功能特點:

支持郵件 s/mime加密的數字簽名

支持郵件多個 TOs, CCs, BCCs and REPLY-TOs

可以工作在任何伺服器平台,所以不用擔心WIN平台無法發送郵件的問題的

支持文本/HTML格式郵件

可以嵌入image圖像

對於郵件客戶端不支持HTML閱讀的進行支持

功能強大的發送郵件調試功能debug

自定義郵件header

冗餘SMTP伺服器支持

支持8bit, base64, binary, and quoted-printable 編碼

文字自動換行

支持多附件發送功能

支持SMTP伺服器驗證功能

在Sendmail, qmail, Postfix, Gmail, Imail, Exchange 等平台測試成功

提供的下載文件中,包括內容詳細的說明文檔及示例說明,所以不用擔心難於上手的問題!

PHPMailer 非常小巧、簡單、方便、快捷

以上資料由Jiucool 翻譯自phpmailer 官網,轉載請註明!

PHPMailer的使用(這裡以使用gmail smtp發送郵件為例,當然也支持sendmail pop 等其他方式):

首先到 下載最新版本的程序包

下載完成後,找到class.phpmailer.php 、class.smtp.php兩個類放到自己的目錄下!

然後新建一個php文件這裡命名為:phpmail_jiucool.php

phpmail_jiucool.php內容如下:

我直接將郵件發送模塊寫成一個函數postmail_jiucool_com(),大家使用的時候直接調用該函數即可,函數內容為:

複製代碼 代碼如下:

function postmail_jiucool_com($to,$subject = “”,$body = “”){

//Author:Jiucool WebSite:

//$to 表示收件人地址 $subject 表示郵件標題 $body表示郵件正文

//error_reporting(E_ALL);

error_reporting(E_STRICT);

date_default_timezone_set(“Asia/Shanghai”);//設定時區東八區

require_once(‘class.phpmailer.php’);

include(“class.smtp.php”);

$mail = new PHPMailer(); //new一個PHPMailer對象出來

$body = eregi_replace(“[\]”,”,$body); //對郵件內容進行必要的過濾

$mail-CharSet =”UTF-8″;//設定郵件編碼,默認ISO-8859-1,如果發中文此項必須設置,否則亂碼

$mail-IsSMTP(); // 設定使用SMTP服務

$mail-SMTPDebug = 1; // 啟用SMTP調試功能

// 1 = errors and messages

// 2 = messages only

$mail-SMTPAuth = true; // 啟用 SMTP 驗證功能

$mail-SMTPSecure = “ssl”; // 安全協議

$mail-Host = “smtp.googlemail.com”; // SMTP 伺服器

$mail-Port = 465; // SMTP伺服器的埠號

$mail-Username = “SMTP伺服器用戶名”; // SMTP伺服器用戶名

$mail-Password = “SMTP伺服器密碼”; // SMTP伺服器密碼

$mail-SetFrom(‘發件人地址,如admin#jiucool.com #換成@’, ‘發件人名稱’);

$mail-AddReplyTo(“郵件回復地址,如admin#jiucool.com #換成@”,”郵件回復人的名稱”);

$mail-Subject = $subject;

$mail-AltBody

= “To view the message, please use an HTML compatible email viewer! –

From “; // optional, comment out and test

$mail-MsgHTML($body);

$address = $to;

$mail-AddAddress($address, “收件人名稱”);

//$mail-AddAttachment(“images/phpmailer.gif”); // attachment

//$mail-AddAttachment(“images/phpmailer_mini.gif”); // attachment

if(!$mail-Send()) {

echo “Mailer Error: ” . $mail-ErrorInfo;

} else {

echo “Message sent!恭喜,郵件發送成功!”;

}

}

原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/237333.html

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
小藍的頭像小藍
上一篇 2024-12-12 12:04
下一篇 2024-12-12 12:04

相關推薦

  • PHP和Python哪個好找工作?

    PHP和Python都是非常流行的編程語言,它們被廣泛應用於不同領域的開發中。但是,在考慮擇業方向的時候,很多人都會有一個問題:PHP和Python哪個好找工作?這篇文章將從多個方…

    編程 2025-04-29
  • PHP怎麼接幣

    想要在自己的網站或應用中接受比特幣等加密貨幣的支付,就需要對該加密貨幣擁有一定的了解,並使用對應的API進行開發。本文將從多個方面詳細闡述如何使用PHP接受加密貨幣的支付。 一、環…

    編程 2025-04-29
  • 使用PHP foreach遍歷有相同屬性的值

    本篇文章將介紹如何使用PHP foreach遍歷具有相同屬性的值,並給出相應的代碼示例。 一、基礎概念 在講解如何使用PHP foreach遍歷有相同屬性的值之前,我們需要先了解幾…

    編程 2025-04-28
  • PHP獲取301跳轉後的地址

    本文將為大家介紹如何使用PHP獲取301跳轉後的地址。301重定向是什麼呢?當我們訪問一個網頁A,但是它已經被遷移到了另一個地址B,此時若伺服器端做了301重定向,那麼你的瀏覽器在…

    編程 2025-04-27
  • PHP登錄頁面代碼實現

    本文將從多個方面詳細闡述如何使用PHP編寫一個簡單的登錄頁面。 1. PHP登錄頁面基本架構 在PHP登錄頁面中,需要包含HTML表單,用戶在表單中輸入賬號密碼等信息,提交表單後服…

    編程 2025-04-27
  • 分析compiler-ssr@3.2.20 email

    該篇文章將從多個方面對compiler-ssr@3.2.20 email進行詳細闡述,並提供相關代碼示例。 一、概述 compiler-ssr@3.2.20 email是一個重要的…

    編程 2025-04-27
  • PHP與Python的比較

    本文將會對PHP與Python進行比較和對比分析,包括語法特性、優缺點等方面。幫助讀者更好地理解和使用這兩種語言。 一、語法特性 PHP語法特性: <?php // 簡單的P…

    編程 2025-04-27
  • PHP版本管理工具phpenv詳解

    在PHP項目開發過程中,我們可能需要用到不同版本的PHP環境來試驗不同的功能或避免不同版本的兼容性問題。或者我們需要在同一台伺服器上同時運行多個不同版本的PHP語言。但是每次手動安…

    編程 2025-04-24
  • PHP數組去重詳解

    一、array_unique函數 array_unique是php中常用的數組去重函數,它基於值來判斷元素是否重複,具體使用方法如下: $array = array(‘a’, ‘b…

    編程 2025-04-24
  • PHP導出Excel文件

    一、PHP導出Excel文件列寬調整 當我們使用PHP導出Excel文件時,有時需要調整單元格的列寬。可以使用PHPExcel類庫中的setWidth方法來設置單元格的列寬。下面是…

    編程 2025-04-24

發表回復

登錄後才能評論