在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ PHP問答
涼汐 回答

單元測試就是測試一個函數(shù)的功能. 給函數(shù)相應(yīng)參數(shù), 獲取函數(shù)返回值, 判斷返回值是不是正確.

和laravel沒啥關(guān)系. 也不需要mockery.

寫testcase, 在里面直接調(diào)用你的類, 函數(shù)就行.

故林 回答

UIViewController loaded the 'TestView.xib', but the Controller's view outlet was not set
你的TestViewController是通過loadNib方式創(chuàng)建的, 而系統(tǒng)在xib中沒有找到能關(guān)聯(lián)到Controller的View.
檢查一下TestViewController的創(chuàng)建方式及TestView.xib的Class是否關(guān)聯(lián)了Controller, Controller的xib必須要關(guān)聯(lián)View.

汐顏 回答

goods_standard: 是哪取出來的,出現(xiàn)這樣的問題,主要是goods_standard這個字段里的數(shù)據(jù),本來就是json格式的,你用json_encode 再轉(zhuǎn)變一就這樣了,你可以運(yùn)行一下以下代碼,看看是data字段是不是和你的結(jié)果很像

<?php
$data = json_encode(['data'=>'大','data1'=>'小']);
$arr = ['name'=>'papersnake','age'=>'35','data'=>$data];
echo(json_encode($arr));
?>

解決方案也有兩種,
1: 在服務(wù)端把goods_standard json_decode 一下轉(zhuǎn)為對象
2:也可以直接放送這樣的JSON到客戶端,客戶端用JSON.parse() 進(jìn)行轉(zhuǎn)換

賤人曾 回答

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

夢一場 回答

PHP本身就提供了一些庫來操作XML,手冊:
http://www.php.net/manual/zh/...

  • DOMDocument

  • ML Expat Parser

  • SimpleXML

  • XMLReader

  • ...

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

自己看看用什么方法來解析~


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

<?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: 成功

更簡單粗暴的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);

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

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

        )

)
尐潴豬 回答
  1. 可以使用php mail擴(kuò)展。按手冊添加相關(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;
}
不討喜 回答

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);
短嘆 回答

require和file_get_contents讀取的文件目標(biāo)的區(qū)域是不一致的,好比java的堆外和堆內(nèi)。。

焚音 回答

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

莓森 回答

版本不對,
要么是5.5的,要么是>=7.0.8的版本
而你的php的版本是7.0.1,所以安裝失敗

逗婦乳 回答

第一種 php5.5或更高版本

$array       = json_decode('[{"id":1,"name":"張三1"},{"id":2,"name":"張三2"},{"id":3,"name":"張三3"},{"id":4,"name":"張三4"},{"id":5,"name":"張三5"},{"id":6,"name":"張三6"},{"id":7,"name":"張三7"}]');
$arrayWithId = array_column($array, null, 'id');
$result      = $arrayWithId[3];
print_r($result);

第二種

你這是json數(shù)組,如果是php需要使用json_decode() 轉(zhuǎn)換為php數(shù)組,然后for循環(huán)

第三種

如是是js處理,3樓說的對

青檸 回答
  1. 在你的擴(kuò)展包(composer.jsonrequire)中包含你依賴的第三方包
  2. https://packagist.org/ 發(fā)布你的擴(kuò)展包
  3. 在你的項(xiàng)目里引入你的擴(kuò)展包
尐懶貓 回答

ip你綁定的是localhost吧

敢試 回答

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

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

舊時光 回答
  1. 首先整理下需求,別人上傳到你的伺服器,只上傳文檔么?需不需要額外訊息?
  2. 其次需要設(shè)計(jì)接口:是不是需要統(tǒng)一化的目錄?比如URL可以是www.xxx.com/api/postFile,那么這個需求怎么通過URL Rewrite來實(shí)現(xiàn);另外通訊使用的方法是GET還是POST(不過你這個比較明顯需要用到POST);怎么處理用戶發(fā)過來的額外訊息;用戶調(diào)用接口后返回的正確/錯誤信息等。
  3. 上邊這些,一個個解決掉,然后整理成接口文檔。
  4. 功能上線聯(lián)調(diào)。