小编Dan*_*Dan的帖子

从print_r输出重新创建原始PHP数组

假设我从某些源代码获得此输出,但我无法访问原始PHP创建的数组:

Array
(
    [products] => Array
        (
            [name] => Arduino Nano Version 3.0 mit ATMEGA328P
            [id] => 10005
        )

    [listings] => Array
        (
            [category] => 
            [title] => This is the first line
This is the second line
            [subtitle] => This is the first subtitle
This is the second subtitle
            [price] => 24.95
            [quantity] => 
            [stock] => 
            [shipping_method] => Slow and cheap
            [condition] => New
            [defects] => 
        )

    [table_count] => 2
    [tables] => Array
        (
            [0] => products
            [1] => listings …
Run Code Online (Sandbox Code Playgroud)

php arrays multidimensional-array output

16
推荐指数
1
解决办法
8083
查看次数

使用MYSQL PHP搜索每个单词而不是完整的字符串

我的搜索允许用户在我的数据库中搜索游戏.唯一的问题是,如果用户在搜索中键入多个术语,则只有当这些多个单词彼此相邻时才会获得命中.

例:

搜索词= Call Call duty Modern

result = none

但如果他们输入:

搜索词=使命召唤 - 或 - 现代战争

结果=使命召唤现代战争1/2/3等

这是我的mysql查询:

$query = "SELECT ID, title FROM games WHERE title LIKE '%{$title}%' AND platform = :platform LIMIT $startFrom,15";
        $statement = $dbG->prepare($query);
        $statement->bindValue(':platform', $platform);
        $statement->execute();
        $gamesLike = $statement->fetch(PDO::FETCH_ASSOC);
Run Code Online (Sandbox Code Playgroud)

我知道我应该打破每个单词并搜索每个术语,但我担心它会耗尽我所有的程序速度......

我可以使用任何特定的MYSQL查询调整来实现我需要的结果吗?

任何建议将不胜感激

感谢您的时间

php mysql string search

3
推荐指数
1
解决办法
2956
查看次数

用于区分 Google Pixel 1/2 与 Google Pixel XL 与 Google Pixel 2 XL 的媒体查询

我正在编写一个cordova应用程序,需要隔离这些谷歌手机来调整样式

鉴于这种:

在此处输入图片说明

我正在努力区分任何 Google Pixel 手机。

@media only screen and (min-width: 411px) and (max-width: 731px) {
    .myDiv{ background-color: blue; }
}
Run Code Online (Sandbox Code Playgroud)

这会在所有像素上触发 - 在模拟器和物理设备中

@media only screen and (min-width: 411px) and (-webkit-device-pixel-ratio: 3) {
    .myDiv{ background-color: blue; }
}
Run Code Online (Sandbox Code Playgroud)

这对于任何像素手机都不会触发 - 如果 3 或 4 像素比率无关紧要

@media screen and (device-width: 411px) and (device-height: 731px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2.6){
   .myDiv{ background-color: blue;
}
Run Code Online (Sandbox Code Playgroud)

这也不会在任何像素手机上触发

我什至都在努力寻找一个可用于隔离 Google Pixel 2 XL 的媒体查询 - 似乎没有发布任何内容 - 但这款手机已经有一段时间了?

有没有人有这方面的运气?

android media-queries google-pixel

3
推荐指数
1
解决办法
1万
查看次数

在C#中定期不断运行函数的更好方法

我有一个C#程序,它不断检查在线数据库的新增功能.我有这个代码让它每10秒检查一次

    static void Main(string[] args)
    {
        boolean run = true;
        while (run)
        {
            DBConnect Db = new DBConnect();

            // do amazing awesome mind blowing cool stuff

            Db.closeConnection();

            // wait for 10 seconds
            int wait = 10 * 1000;
            System.Threading.Thread.Sleep(wait);
        }
    }
Run Code Online (Sandbox Code Playgroud)

我有错误报告,发布到数据库,如果发生重大错误,程序关闭.在我的函数中的特定错误之外,这种方法安全有效吗?

c# wait

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