鍍金池/ 問(wèn)答/ PHP問(wèn)答
情殺 回答

item不是個(gè)對(duì)象嗎?你為什么綁給value? 你應(yīng)該給value綁定gradeName啊!

尐潴豬 回答
  1. 可以使用php mail擴(kuò)展。按手冊(cè)添加相關(guān)配置之后調(diào)用

http://php.net/manual/zh/mail...

$to = "someone@example.com";         // 郵件接收者
$subject = "參數(shù)郵件";                // 郵件標(biāo)題
$message = "Hello! 這是郵件的內(nèi)容。";  // 郵件正文
$from = "someonelse@example.com";   // 郵件發(fā)送者
$headers = "From:" . $from;         // 頭部信息設(shè)置
mail($to,$subject,$message,$headers);
echo "郵件已發(fā)送";

2.也可以使用phpmailer發(fā)送
https://github.com/PHPMailer/...

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require 'vendor/autoload.php';

$mail = new PHPMailer(true);                              // Passing `true` enables exceptions
try {
    //Server settings
    $mail->SMTPDebug = 2;                                 // Enable verbose debug output
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = 'user@example.com';                 // SMTP username
    $mail->Password = 'secret';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;                                    // TCP port to connect to

    //Recipients
    $mail->setFrom('from@example.com', 'Mailer');
    $mail->addAddress('joe@example.net', 'Joe User');     // Add a recipient
    $mail->addAddress('ellen@example.com');               // Name is optional
    $mail->addReplyTo('info@example.com', 'Information');
    $mail->addCC('cc@example.com');
    $mail->addBCC('bcc@example.com');

    //Attachments
    $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
    $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name

    //Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}

PHP本身就提供了一些庫(kù)來(lái)操作XML,手冊(cè):
http://www.php.net/manual/zh/...

  • DOMDocument

  • ML Expat Parser

  • SimpleXML

  • XMLReader

  • ...

參考一下文章例子
http://blog.csdn.net/aloneswo...

自己看看用什么方法來(lái)解析~


哪里解決不了?
比如這樣吧,遍歷層層解析:

<?php
header("Content-type:text/html; Charset=utf-8");

$content = "
<commpara>
  <itempara>
    <pararow>
      <retcode>0</retcode>
      <retstr>成功</retstr>
    </pararow>
  </itempara>
</commpara>
";

// $xml = simplexml_load_file("test.xml");
$xml = simplexml_load_string($content);

echo '第一層:' . $xml->getName() . "<br />";

foreach($xml->children() as $child){
    echo '第二層:' . $child->getName(). "<br />";

    foreach($child->children() as $subChild){
        echo '第三層:' . $subChild->getName() . "<br />";

        foreach($subChild->children() as $item){
            echo $item->getName() . ": " . $item . "<br />";
        }
    }
}

輸出:

第一層:commpara
第二層:itempara
第三層:pararow
retcode: 0
retstr: 成功

更簡(jiǎn)單粗暴的XML轉(zhuǎn)數(shù)組,這樣子:

$content = "
<commpara>
  <itempara>
    <pararow>
      <retcode>0</retcode>
      <retstr>成功</retstr>
    </pararow>
  </itempara>
</commpara>
";

$xml = simplexml_load_string($content);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
print_r($array);

輸出,直接就是個(gè)數(shù)組:

Array
(
    [itempara] => Array
        (
            [pararow] => Array
                (
                    [retcode] => 0
                    [retstr] => 成功
                )

        )

)
愿如初 回答

存放COOKIE的時(shí)候 存一個(gè)A 一個(gè)key=>value
后端存COOKIE的時(shí)候 自己用保密的私鑰B 通過(guò)算法(B+key=>value) 得出A
把A和key=>value 同時(shí)存在客戶端,使用的時(shí)候 也必須用同等的算法校驗(yàn)下數(shù)據(jù)合法性

不討喜 回答

1.用max函數(shù)查詢t_order表(我加了前綴,user表也是)并根據(jù)user分組,獲取最大的time數(shù)據(jù)
2.以步驟一的結(jié)果作為查詢條件,進(jìn)行子查詢

字段名稱、表明有所調(diào)整,不要在意這些細(xì)節(jié)

select * from t_order o where EXISTS (select 1 from
(select max(t.time) tm,t.user_id uid from t_order t group by t.user_id) f
where o.time = f.tm and o.user_id = f.uid);
吢丕 回答

也許可以先去了解一下“字體格式”。里面解析后應(yīng)該可以解析出“部件”,然后可以生成一個(gè)初步的筆順(從上到下,從左到右)
然后,再補(bǔ)充以拆部件之后,人工窮舉的順序,那么大概率可以組合出每個(gè)字的筆順吧。
沒(méi)實(shí)際做過(guò),只是思路。

夕顏 回答

addBomItem所在的js引入了嗎?

賤人曾 回答

檢查下控制器中是否使用了__construct方法或者_(dá)initialize,加一句parent::_initialize試試

焚音 回答

性能沒(méi)太大影響,如果頁(yè)面需要搜索引擎收錄的好這樣不行,爬蟲(chóng)爬取的頁(yè)面不執(zhí)行js,如果不需要搜索引擎收錄,這種ajax請(qǐng)求之后,數(shù)據(jù)渲染用戶體驗(yàn)度還是不錯(cuò)的

尤禮 回答

不要用賦初始值。redux數(shù)據(jù)盡量扁平化。但是需要。stat.key =null。每次用數(shù)據(jù)的時(shí)候用lodash判斷一下isPlainObject或者isArray。

眼雜 回答

表KEY_COLUMN_USAGE在information_schema庫(kù)里,要指定庫(kù)名才能獲取得到。

SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA='表對(duì)應(yīng)的庫(kù)名' AND REFERENCED_TABLE_NAME='DC_CommodityItem' AND REFERENCED_COLUMN_NAME='CommodityItemID';

獲取得到數(shù)據(jù)就是有包含外鍵

久不遇 回答
display: flex;
align-items:center;
justify-content:center;
尐懶貓 回答

ip你綁定的是localhost吧

墨小羽 回答

絕對(duì)路徑不行嗎?/js/target.js

尋仙 回答

微服務(wù)本身注冊(cè)中心就是監(jiān)控服務(wù),業(yè)務(wù)可以說(shuō)是實(shí)時(shí)監(jiān)控并獲取,并且調(diào)整或修改會(huì)有事件通知

這里的問(wèn)題是,業(yè)務(wù)需要硬編碼,因?yàn)椴恢烙行路?wù)上線,這問(wèn)題有點(diǎn)先有雞先有蛋的問(wèn)題

如果要做個(gè)盡可能的自動(dòng)化,前期做好一定的調(diào)用規(guī)則是一種好解決方案

敢試 回答

你這curl調(diào)用接口返回得是json數(shù)據(jù)吧?
你要先把這個(gè)json數(shù)據(jù)轉(zhuǎn)換成數(shù)組或者對(duì)象才能循環(huán)呀

json_decode 對(duì)json格式得字符串進(jìn)行解碼。

我以為 回答

使用request.getParameterMap()返回Map集合,key為name屬性,value為String數(shù)組