小编cha*_*lie的帖子

PHP函数中缺少参数 - 如何停止警告

我有一个PHP函数来发送电子邮件,

function sendemail($email_to,$email_from,$email_subject,$email_body,$email_replyto,$cc)
    {
        if(filter_var($email_to, FILTER_VALIDATE_EMAIL))
        {
            require_once "/usr/local/lib/php/Mail.php";

            $from = $email_from;
            $to = $email_to;
            $subject = $email_subject;
            $body = $email_body;

            $host = "mail.domain.co.uk";
            $username = "sending@domain.co.uk";
            $password = "********";

            $headers = array ('From' => $from,
              'To' => $to,
              'Cc' => $cc,
              'Subject' => $subject,
              'Content-type' => 'text/html');
            $smtp = Mail::factory('smtp',
              array ('host' => $host,
             'auth' => true,
             'username' => $username,
             'password' => $password));

             $rec = $to.', '.$cc;

            $mail = $smtp->send($rec, $headers, $body, $cc);
        }
    }
Run Code Online (Sandbox Code Playgroud)

当我调用该函数时,有时候没有$cc变量,所以我得到一个警告说Missing …

php arguments function

1
推荐指数
1
解决办法
4171
查看次数

PHPMailer发送到以a分隔的多个地址,

我正在使用PHPMailer发送电子邮件,我使用它来添加要发送到的电子邮件地址:

$email->AddAddress($result["emailto"]);
Run Code Online (Sandbox Code Playgroud)

我的电子邮件地址来自数据库,它工作正常,但如果我的数据库中的emailto列如下所示:

email1@domain.com,email2@domain.com
Run Code Online (Sandbox Code Playgroud)

我收到错误消息说您必须提供至少一个收件人电子邮件地址.

我怎样才能绕过这个能够发送到多个地址?

php email

1
推荐指数
1
解决办法
2万
查看次数

使用PHP在mysql数据库中选择下一行

我正在运行一个选择SQL查询:

select * from table where sequence = '6' 
Run Code Online (Sandbox Code Playgroud)

我希望能够获得下一行,但它可能不是序列7,因为这可能不存在.

如果下一行是序列9,我将如何选择它?

php mysql

1
推荐指数
1
解决办法
962
查看次数

使文本垂直居中显示在图像旁边

我有这个CSS,我用它来显示一些文本左侧的DIV:

#type_box {
    width:30px;
    height:30px;
    margin-right:10px;
    border-radius:20px;
    float:left;
    display:inline;
}
.box_okay {
    background:url(http://s29.postimg.org/gjnuph0gz/tick.png) no-repeat;
    background-size: contain;
}
Run Code Online (Sandbox Code Playgroud)

我希望文本正好在图像的垂直中心(图像显示在文本的左侧)

http://jsfiddle.net/P3CFU/

html css

1
推荐指数
1
解决办法
44
查看次数

PHP循环有多行

我有这个PHP代码:

$number = substr_replace($_POST["number"],"44",0,1);

$sql="SELECT * from channel_did where did LIKE '%".$number."%' AND (client_id = '' OR client_id IS NULL or client_id = '611') AND (extension_id = '' OR extension_id IS NULL) ";
$rs=mysql_query($sql,$pbx01_conn) or die(mysql_error());
while($result=mysql_fetch_array($rs))
{
    $numbers_list = $result["did"].'<br>';
    $email_body = '<font face="Arial">
    Hello, here are some numbers that you have requested.<br><br>
    Please be aware that these numbers are in a public pool and not reservered, therefore they could be assigned to another client at any time.<br><br>
    Please …
Run Code Online (Sandbox Code Playgroud)

php mysql

0
推荐指数
1
解决办法
158
查看次数

CSS Div上没有显示的背景图片

我有这个CSS代码:

#type_box {
    width:30px;
    height:30px;
    margin-right:5px;
    border-radius:20px;
}
.box_okay {
    background:url(/images/tick.png) no-repeat;
}
.box_none {
    background:#000000;
}
.box_Warning {
    background:url(/images/tick.png) no-repeat;
}
.box_Error {
    background:url(/images/cross.png) no-repeat;
}
.box_Maintenance {
    background:url(/images/spanner.png) no-repeat;
}
Run Code Online (Sandbox Code Playgroud)

这个HTML:

<div id="type_box" class="box_okay"></div>
<div id="type_box" class="box_Warning"></div>
<div id="type_box" class="box_Error"></div>
<div id="type_box" class="box_Maintenance"></div>
Run Code Online (Sandbox Code Playgroud)

但图像没有显示 - 这是一个例子:http://jsfiddle.net/42usL/

html css

0
推荐指数
1
解决办法
92
查看次数

PDO参数号错误消息无效

我正在运行此PDO SQL查询:

$stmt = $pdo_conn->prepare("INSERT into ticket_updates (ticket_seq, notes, datetime, updatedby, customer, internal_message) values (:ticket_seq, :notes, :datetime, :updatedby, :customer, :internal_message) ");
                $stmt->execute(array(':ticket_seq' => $ticketnumber, 
                ':notes' => addslashes($message), 
                ':datetime' => date("Y-m-d H:i:s"),  
                ':updateedby' => $last_updated_by, 
                ':customer' => 'Y', 
                ':internal_message' => 'no'));
Run Code Online (Sandbox Code Playgroud)

但得到这个错误:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined' in /home/integra/public_html/autocheck/support_emails.php:479 Stack trace: #0 /home/integra/public_html/autocheck/support_emails.php(479): PDOStatement->execute(Array) #1 {main} thrown in /home/integra/public_html/autocheck/support_emails.php on line 479
Run Code Online (Sandbox Code Playgroud)

我不知道问题是什么,所有其他查询工作正常

php mysql pdo

0
推荐指数
1
解决办法
99
查看次数

PHP仅允许某些字符并替换所有其他字符

我有一个PHP变量,我需要删除所有特殊字符,如% / é / !

如何用a替换A-Z/ a-z/ 0-9.(句号)以外的所有字符_

php

-3
推荐指数
1
解决办法
124
查看次数

标签 统计

php ×6

mysql ×3

css ×2

html ×2

arguments ×1

email ×1

function ×1

pdo ×1