我是Angular 2的新手,正在尝试延迟加载.我收到错误"RangeError:超出最大调用堆栈大小"
我尝试了很多其他类似的问题,但对我没什么用.以下是我的代码供您参考.让我知道这个问题.
// App Module
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { ROUTER_CONFIG } from './app.routing';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
ROUTER_CONFIG
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
// App Routing
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component'; …Run Code Online (Sandbox Code Playgroud)我正在使用 Laravel 刀片。我想将 php 变量与 Blade 代码中的字符串连接起来。
以js为例:
<img class="img-responsive" src='http://example.com/'+ user_id +'/picture?type=square';/>
Run Code Online (Sandbox Code Playgroud)
如何用 php 变量写这个?
<img class="img-responsive" src='http://example.com/'. {{ $user_id}} .'/picture?type=square';/>
Run Code Online (Sandbox Code Playgroud) 当前,我正在尝试使用命令行phpunit tests / Unit / ExampleTest在laravel项目上使用phpunit运行一些简单的单元测试。但是它仅运行第一种方法。有人有解决方案吗?谢谢 !
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$this->assertTrue(true);
}
/**
* An other basic test
*
* @return void
*/
public function secondTestBasicTest()
{
$this->assertTrue(true);
}
public function basicTest(){
$response = $this->action('GET', 'DepartementsController@display', ['id' => 1]);
$view = $response->original;
$this->assertEquals(1, $view['$dpt->iddepartement']);
}
}
Run Code Online (Sandbox Code Playgroud) 我将在接下来的 8 小时内部署一个网站,而 Gmail 只是停止接受 PHPmailer 登录我的帐户。起初它在测试时工作了好几个小时。然后,它就停止工作了.. 我已经允许所有允许不太安全的应用程序从 gmail 登录,但它仍然不允许 phpmailer 登录。我想跳下悬崖!
这是几个小时前运行良好的相同代码:
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = 'myemail@gmail.com';
$mail->Password = 'password';
$mail->SMTPSecure = 'ssl';
$mail->Port = 587;
Run Code Online (Sandbox Code Playgroud)
然后出于某种原因,gmail 刚刚开始阻止登录尝试。我希望我能在这里得到一些帮助,我已经找了一个多小时了,但还是一无所获。
谢谢!
我正在尝试使用单个语句执行多个插入来实现此目的,我正在使用 Insert into select 语句。但是我面临着当两列在插入中具有相同的值时。我收到的错误消息是ORA-00918: column ambiguously defined.
询问
INSERT INTO sample (
HOST,
TOTAL_PING,
TOTAL_UNAVAILABLE_PING
)
SELECT * FROM (
SELECT 'FR3158-73-1',
82,
82
FROM DUAL
UNION ALL
SELECT 'FR3158-76-2',
80,
10
FROM DUAL
)
Run Code Online (Sandbox Code Playgroud)
如果我将一个值更改为有效的值,则第一个 select 语句中存在两个值是 82 和 82 的问题。即使列值相同,我也不知道如何进行这项工作。
- - 更新 - -
表定义
CREATE TABLE sample
(
ID NUMBER GENERATED ALWAYS as IDENTITY(START with 1 INCREMENT by 1) PRIMARY KEY,
HOST VARCHAR2(15 BYTE),
TOTAL_PING INTEGER,
TOTAL_UNAVAILABLE_PING INTEGER,
ADDED_ON TIMESTAMP(6) DEFAULT systimestamp
);
Run Code Online (Sandbox Code Playgroud) 图书馆 = https://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/
这是我的代码:我需要获取所有输入值,$("input").val()但我return =""一直使用。
输入标签
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"> </script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.min.js"></script>
</head>
<body>
<input type="text" value="Amsterdam,Washington,Sydney,Beijing,Cairo" data-role="tagsinput" />
</body>
</html>Run Code Online (Sandbox Code Playgroud)
这是我的代码片段:
for($x=0;$x<=$flaga1;$x++){
$index++;
echo "<div class=\"item\" data-slide-number=".$index.">".$sth."</div>";
}
Run Code Online (Sandbox Code Playgroud)
它依赖于迭代代码$sth.但我想active在第一次出现代码时添加类,所以它将是:
<div class="active item" data-slide-number="0">"sth"</div>
<div class="item" data-slide-number="1">"sth"</div>
<div class="item" data-slide-number="2">"sth"</div>
Run Code Online (Sandbox Code Playgroud)
我正在尝试做这样的事情,但它不起作用:
for($x=0;$x<=$flaga1;$x++){
$active=0;
$divclass="<div class=\"item\"";
do {
$divclass="<div class=\"active item\"";
$active++;
} while ($active<=0);
$index++;
echo "".$divclass." data-slide-number=".$index.">".$sth."</div>";
}
Run Code Online (Sandbox Code Playgroud) 我正在使用codeigniter来查询数据库,我需要在where子句中有条件地比较数组.
所以基本上我想做:where_in OR where_in取决于哪个数组中包含数据.所以我将有一个user_id数组或一个area_id数组.
我不确定如何结合where_in比较.这是我需要修改的查询:
public function get_checks_test($org_id,$users,$areas) {
// get todays date
$todays_date = date("Y-m-d");
// build where array
$check_array = array('c.org_id =' => $org_id, 'c.status !=' => '0', 'c.due <=' => $todays_date);
// build query
$this->db->select('c.*,a.check_area_id,b.check_user_id,d.area_name,u.first_name,u.last_name');
$this->db->order_by('c.due', 'asc');
$this->db->where($check_array);
$this->db->where_in('user_id', $users);
$this->db->or_where_in('area_id', $areas);
$this->db->join('check_assigned_areas a','a.check_id = c.check_id','left');
$this->db->join('check_assigned_users b','b.check_id = c.check_id','left');
$this->db->join('areas d','d.area_id = a.check_area_id','left');
$this->db->join('users u','u.id = b.check_user_id','left');
$check_object = $this->db->get('checks c');
return $check_object->result();
}
Run Code Online (Sandbox Code Playgroud)
我不认为我能找到一个or_where_in函数.
我可以这样做,还是需要重新考虑?
谢谢
php ×5
laravel ×2
activerecord ×1
angular ×1
codeigniter ×1
email ×1
for-loop ×1
gmail ×1
image ×1
javascript ×1
jquery ×1
lazy-loading ×1
mysql ×1
ora-00918 ×1
oracle ×1
oracle12c ×1
phpmailer ×1
phpunit ×1
sql ×1
sql-insert ×1
unit-testing ×1
where-in ×1