小编Oza*_*urt的帖子

使用 php 将 imagestring() 居中?

我正在尝试为我的欢迎页面创建一个图像,并希望将字符串动态居中,否则使用不同的用户名(例如 John 和 Alexandra)就太糟糕了。

header("Content-type: image/png");

$string1 = "Hello!";
$string2 = "Welcome to our website!";
$srting3 = "$username";

$font1  = 5;
$font2  = 3;
$font3  = 3;

$img_w = 240;
$img_h =  64;

$image = imagecreatetruecolor ($img_w, $img_h);
$white = imagecolorallocate   ($image, 255,255,255);
$black = imagecolorallocate   ($image,   0,  0,  0);
imagefill($image, 0, 0, $white);

imagestring ($image, $font1, 110,  0, $string1, $black);
imagestring ($image, $font2,  60, 20, $string2, $black);
imagestring ($image, $font3, 105, 40, $string3, $black);

imagepng ($image);
imagedestroy($image);
Run Code Online (Sandbox Code Playgroud)

css php

6
推荐指数
1
解决办法
5713
查看次数

在jQuery中是否有类似array_unique()的函数?

我有一个选择,我可以得到一些像数组一样的值 ["1","2","3"]

在每次更改时,我运行以下代码以获得连接到这些值的数组的结果

$('#event-courses-type').on('change',function(){

    type = $('#event-courses-type').val();

    console.log(type);

    var var1 = ["4689 Leadership Award", "UKCC Level 1", "UKCC Level 2", "UKCC Level 3", "UKCC Level 4", "Old WHU Award", "None at present"];
    var var2 = ["4689 Leadership Award", "GB-wide Level 1", "Old Level 1 (Pre January 2012)", "Level 2", "Level 3", "EHF", "FIH", "None at present"];

    var var5 = ["D32/33", "A1 Assessor", "CTS", "IAPS", "PTLLS", "AVRA", "Umpire Educator Training", "Umpire Assessor Training"];
    var var6 = ["D32/33", "A1 Assessor", "CTS", "IAPS", …
Run Code Online (Sandbox Code Playgroud)

javascript php arrays jquery

6
推荐指数
1
解决办法
9145
查看次数

从数据透视表中查找一行

我有两个被调用的表conversations,users它们与conversation_user包含a user_idconversation_id列的数据透视表绑定.

| conversation_id | user_id |
|-----------------|---------|
|               1 |       1 |
|               1 |       2 |
|               2 |       1 |
|               2 |       2 |
|               2 |       3 |
Run Code Online (Sandbox Code Playgroud)

我想向数据库发送一些用户ID并检索它们在一起的对话.

例如:

当我把12我必须接受conversation_id 1,当我发送1,23我必须接受conversation_id 2.

我怎么写这样的查询?

mysql sql

6
推荐指数
1
解决办法
66
查看次数

Algolia免费计划的操作计数

100,000
then paused
until renewal
Run Code Online (Sandbox Code Playgroud)

Algolia定价页面包含一个像这样的单元格的免费计划.

这是否意味着在100.000操作之后客户应该切换到付费计划,或者它是否像其他计划一样重置?

algolia

2
推荐指数
1
解决办法
325
查看次数

向对象添加方法

我在javascript中向对象添加方法时遇到问题.以下代码应返回一个数字,而是返回NaN.希望你能帮忙

function people(name, age){
    this.name = name;
    this.age = age;
    this.numYearsLeft = pension();
}

function pension(){
    numYears = 65 - this.age;
    return numYears;
}

var andrews = new people("Andrews Green", 28);

console.log(andrews.numYearsLeft);
Run Code Online (Sandbox Code Playgroud)

javascript

2
推荐指数
1
解决办法
81
查看次数

标签 统计

javascript ×2

php ×2

algolia ×1

arrays ×1

css ×1

jquery ×1

mysql ×1

sql ×1