我正在尝试创建与当前颜色相反的颜色.我的意思是如果当前颜色是黑色,那么我需要生成白色.
其实我有一个文本(这个文本的颜色是动态的,它的颜色可以随机制作).这是文成div,我需要设置文本的颜色相反的background-color的div.我想在(颜色透视)中明确该文字.div
相反的颜色表示:暗/亮
我有当前的文本颜色,我可以将它传递给这个函数:
var TextColor = #F0F0F0; // for example (it is a bright color)
function create_opp_color(current color) {
// create opposite color according to current color
}
create_opp_color(TextColor); // this should be something like "#202020" (or a dark color)
Run Code Online (Sandbox Code Playgroud)
是否有创建create_opp_color()功能的想法?
我有一个包含10个方法的类.我总是需要使用其中一种方法.现在我想知道,哪种方法更好?
class cls{
public function func1(){}
public function func2(){}
.
.
public function func10(){}
}
$obj = new cls;
$data = $obj->func3(); // it is random, it can be anything (func1, or func9 or ...)
Run Code Online (Sandbox Code Playgroud)
要么
class cls{
public static function func1(){}
public static function func2(){}
.
.
public static function func10(){}
}
cls::func3(); // it is random, it can be anything (func1, or func9 or ...)
Run Code Online (Sandbox Code Playgroud) 我正在尝试修改现有的迁移.我的意思是,这是我目前的迁移类:
class CreateLogForUserTable extends Migration
{
public function up()
{
Schema::create('log_for_user', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id');
$table->string('table_name');
$table->string('error_message');
$table->unsignedTinyInteger('error_code');
$table->timestamps();
});
}
public function down()
{
Schema::drop('log_for_user');
}
}
Run Code Online (Sandbox Code Playgroud)
我也曾执行php artisan migrate过一次这个命令.现在我需要向列中添加->nullable()方法error_message.所以我编辑了我的迁移,如下所示:
.
.
$table->string('error_message')->nullable();
.
.
Run Code Online (Sandbox Code Playgroud)
但当我php artisan migrate再次执行时,它说:
什么都没有迁移.
无论如何,我如何应用新版本的迁移?
我有三个值:0,1,NULL.现在我想知道,该列可以使用哪种数据类型?
但是方式,NULL是该列的默认值(在数据库中)和我实现0和1形成URL的参数(get方法).像这样的东西:
www.example.com/?q=param=0
Run Code Online (Sandbox Code Playgroud)
然后
$var = isset($_GET['param']) ? $_GET['param'] : null;
Run Code Online (Sandbox Code Playgroud)
然后
INSERT INTO table(col) values ($var);
Run Code Online (Sandbox Code Playgroud) 我有这样一张桌子:
// cookies
+----+---------+-------------------+------------+
| id | user_id | token | expire |
+----+---------+-------------------+------------+
| 1 | 32423 | dki3j4rf9u3e40... | 1467586386 |
| 2 | 65734 | erhj5473fv34gv... | 1467586521 |
| 3 | 21432 | 8u34ijf34t43gf... | 1467586640 |
+----+---------+-------------------+------------+
Run Code Online (Sandbox Code Playgroud)
我有这个问题:
SELECT 1
FROM cookies
WHERE user_id = :id AND
token = :token
Run Code Online (Sandbox Code Playgroud)
注意:始终将结果要么是一个行或零列.(令牌列是unique)
当有匹配的行时,确定,一切正常,但是当没有任何匹配的行时,我想明白为什么?
user_id存在但token不存在token存在但user_id不存在如何确定"没有选择(匹配)行"的原因?
编辑:以下是所有可能的输出:
我有这个字符串:
var str = '??? ?? @???.? ??? ???';
// I want this ^^^^^
Run Code Online (Sandbox Code Playgroud)
我可以这样选择它:
/@(.{5})/
Run Code Online (Sandbox Code Playgroud)
但这不是我需要的,因为@在空间之前和之前的那个词的长度 isn't always 5.我真的不知道为什么\w不匹配波斯人物.甚至[a-zA-Z]也不起作用.
好吧,我怎么能这样做?
这是我的代码:
$("#one_to_many").on("click", function(){
$( this ).html('<form action="demo_form.asp">\
<input type="checkbox" name="graph" value="like"> ????? ??<br>\
<input type="checkbox" name="graph" value="comment" checked> ???? ??<br>\
<input type="checkbox" name="graph" value="friend" checked> ??????<br>\
<input type="button" value="??? ????">\
</form>');
});Run Code Online (Sandbox Code Playgroud)
div{
border:1px solid;
text-align: center;
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="one_to_many">click</div>Run Code Online (Sandbox Code Playgroud)
如你所见,我无法触发那些复选框.换句话说,我无法将复选框选项标记为已选中或取消选中它.
我怎样才能使它可用?
我使用Laravel框架,最近我被告知有一些名称database seeding会为我们的测试生成一个假数据集.我的理解是否正确?
那太奇怪了.这个怎么运作?它如何知道我在X列数据库中需要哪种类型的数据?它是如何产生的?
另外,我不能制作真实数据集的种子(类似于导出)吗?你知道,我不太懂英语,这就是为什么我无法理解数据库领域种子的概念.
当我在Laravel框架中使用此代码时:
throw new Exception("failed");
Run Code Online (Sandbox Code Playgroud)
它会抛出此错误:
MyController.php第178行中的FatalErrorException:未找到类'App\Http\Controllers\Exception'
有谁知道我怎么能use (include)那个Exception类给我的控制器?实际上在哪里?