單元測試就是測試一個函數(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)換
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] => 成功
)
)
)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);getImageData還報什么錯?還是跨域嗎
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,所以安裝失敗
$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樓說的對
composer.json的require)中包含你依賴的第三方包ip你綁定的是localhost吧
你這curl調(diào)用接口返回得是json數(shù)據(jù)吧?
你要先把這個json數(shù)據(jù)轉(zhuǎn)換成數(shù)組或者對象才能循環(huán)呀
json_decode 對json格式得字符串進(jìn)行解碼。
lunix 服務(wù)器問題,最好不要使用中文
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實(shí)現(xiàn)中華民族偉大復(fù)興的升級產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。