小编Nas*_*zad的帖子

如何检查存储库是否通过 HTTP 或 ssh 克隆?

我需要一种快速的方法来了解我所在的存储库是通过 HTTP 还是 ssh 克隆的?正在寻找来自 Git 或任何其他配置检查点的命令来为我提供此信息。

git ssh configuration http

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

Laravel 在插入查询中插入了多少行?

我有这个疑问Laravel,我很想知道。是否有办法知道表中插入了多少记录或忽略了多少记录?

DB::table('mytable')->insertOrIgnore($data)
Run Code Online (Sandbox Code Playgroud)

注:手动方式之一可以是,统计加工前后表的记录。但这会影响性能,如果有更好的方法来实现这一点。

insert count laravel eloquent

9
推荐指数
1
解决办法
2290
查看次数

需要一个可以在WordPress中访问的自定义功能

我有这个通知功能,需要在代码的不同位置调用它.我需要把它放在我的子主题内以及plugins目录中的任何文件所访问的位置.

function send_notification($tokens, $message)
{
    $url = 'https://fcm.googleapis.com/fcm/send';
    $fields = array(
         'registration_ids' => $tokens,
         'data' => $message
        );
    $headers = array(
        'Authorization:key = My_Token',
        'Content-Type: application/json'
        );

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_POST, true);
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);  
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
   curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
   $result = curl_exec($ch);           
   if ($result === FALSE) {
       die('Curl failed: ' . curl_error($ch));
   }
   curl_close($ch);

   return $result;
}
Run Code Online (Sandbox Code Playgroud)
  • 第一个问题,在哪里放,目前它在functions.php?
  • 第二个问题,如何在不同的地方称呼它?

任何解决方案和参考将不胜感激.谢谢.

wordpress notifications function call

7
推荐指数
1
解决办法
316
查看次数

有没有办法在 sass 中实现这一点?

我找不到在 sass 中实现我所需要的方法,您可以帮助我了解这一点。

假设这是代码。

p, span {
    font-size: 12px;
    // other styles

    &:hover {
        color: blue;
    }
}
Run Code Online (Sandbox Code Playgroud)

我在这里需要的是为这两个选择器中的每一个添加不同颜色的悬停颜色,假设 p 元素为蓝色,span 为红色,目前我是这样做的:

p, span {
    font-size: 12px;
    // other styles
}

p:hover {
    color: blue;
}

span:hover {
    color: red;
}
Run Code Online (Sandbox Code Playgroud)

这里的问题是选择器的重复,这似乎不是一个好习惯,我正在考虑这样的事情或任何类似的方式:

p, span {
    font-size: 12px;
    // other styles

    &:first-selector:hover {
        color: blue;
    }
    &:second-selector:hover {
        color: red;
    }
}
Run Code Online (Sandbox Code Playgroud)

提前致谢。

dry sass css-selectors

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

在 GitHub 操作中更新/编辑工作流程文件

我已经配置了手动工作流程并且运行正常,但是一旦我更新/编辑它并将其提交到同一分支,更改就不会影响它。我的意思是该操作仍然运行,但使用旧版本的工作流程文件。我需要做什么步骤吗?

我编辑工作流程文件时遵循的步骤: https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions#browsing-marketplace-actions-in-the-workflow-editor

这是工作流程文件详细信息,以防万一

原本的:

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the "development" branch
  release:
    types: [created]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs: …
Run Code Online (Sandbox Code Playgroud)

workflow continuous-integration action github

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