却一份温柔

文章 评论 浏览 28

却一份温柔 2025-02-20 20:46:27

C ++ 20的两个新添加使这可能成为可能(请注意,您的代码不会在早期的标准版本中编译)。

  1. 编译器将尝试用a!= b!(a == b)如果没有合适的!=参数。

  2. 如果没有合适的a == b,编译器将尝试b == a

因此,发生了什么 - 编译器首先注意到它不知道如何比较10!= i,因此它尝试!(10 == I)。仍然没有合适的比较,因此它尝试!(i == 10),最终可以使用您的隐式构造函数将10转换为integer < /code>。
可以通过在debug打印中添加更多信息来轻松验证:

  bool
  operator== (const Integer &i) const
  {
    std::cout << x << "==" << i.x << ' ';
    return x == i.x;
  }

将在最后一行中打印0 == 10 1在线查看)。


如注释中注意到的那样,您甚至不需要操作员!=,由于上述行为C ++ 20编译器将自动将任何此类调用转换为operator ==

There are two new additions to C++20 that made this possible (note that your code doesn't compile in earlier standard versions).

  1. Compiler will attempt to replace a != b with !(a == b) if there is no suitable != for these arguments.

  2. If there is no suitable a == b, compiler will attempt b == a as well.

So, what happens - compiler first notices that it doesn't know how to compare 10 != i, so it tries !(10 == i). There is still no suitable comparison, so it tries !(i == 10) and it can finally be done using your implicit constructor to convert 10 to Integer.
It can be easily verified by adding more info to debug print:

  bool
  operator== (const Integer &i) const
  {
    std::cout << x << "==" << i.x << ' ';
    return x == i.x;
  }

will print 0==10 1 in the last line (see it online).


As noticed in comments, you don't even need operator !=, due to aforementioned behaviour C++20 compiler will automatically convert any such call to operator ==.

过载运算符上的错误函数调用

却一份温柔 2025-02-19 23:29:09

您的图像字段只有图像的数量,因此无法直接访问和显示。取而代之的是,您应该在错别字渲染定义中添加文件processor,以解决与文件的关系。

对于一个自定义内容元素,它看起来像这样:

tt_content {
   examples_dataprocfiles =< lib.contentElement
   examples_dataprocfiles {
      templateName = DataProcFiles
      dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
      dataProcessing.10 {
         as = images
         references.fieldName = image
         references.table = tt_content
         sorting = title
         sorting.direction = descending
      }
   }
}

流体输出会像这样处理:

<f:for each="{images}" as="image">
     <f:image image="{image}" height="250"/>
</f:for>

请参见文档和更详细的示例: https://docs.typo3.org/m/typo3/reference-reference-typoscript/11.5/en-us/contentobjects/contentobjects/fluidtemplate/dataprocessing/filesprocessing/filesprocessor.html#typoscript

Your image field just holds the count of images, so its not possible to access and display it directly. Instead you should add a FileProcessor in your typoscript rendering definition to resolve the relations to your files.

For a custom content element it could look like this:

tt_content {
   examples_dataprocfiles =< lib.contentElement
   examples_dataprocfiles {
      templateName = DataProcFiles
      dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
      dataProcessing.10 {
         as = images
         references.fieldName = image
         references.table = tt_content
         sorting = title
         sorting.direction = descending
      }
   }
}

Fluid output is then handled like this:

<f:for each="{images}" as="image">
     <f:image image="{image}" height="250"/>
</f:for>

See docs and more detailed example here: https://docs.typo3.org/m/typo3/reference-typoscript/11.5/en-us/ContentObjects/Fluidtemplate/DataProcessing/FilesProcessor.html#typoscript

如何在Typo3中使用流体显示多个图像?

却一份温柔 2025-02-19 07:34:23

data-toggle =“ collapse” href =“#collapse2”添加到打开##collapse2的链接。为了防止hashchange事件触发,您可以将&lt; a&gt;元素更改为另一个标签,例如'

.btn-link {
  cursor: pointer
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>

<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
  <section class="hotspots--wrapper">
    <img src="/images/produktbeschreibung/wheel-585x.png" alt="" class="hotspots--figure">
    <span class="hotspot hotspot--harz btn-link" data-toggle="collapse" data-parent="#accordion" href="#collapse1">
      <span class="hotspot--title hotspot--title__right">Harz</span>
    <span class="hotspot--cta"></span>
    </span>
    <span class="hotspot hotspot--felge btn-link" data-toggle="collapse" data-parent="#accordion" href="#collapse2">
      <span class="hotspot--title">Felge</span>
    <span class="hotspot--cta"></span>
    </span>
    <span class="hotspot hotspot--speichen btn-link" data-toggle="collapse" data-parent="#accordion" href="#collapse3">
      <span class="hotspot--title hotspot--title__right">Speichen</span>
    <span class="hotspot--cta"></span>
    </span>
    <span class="hotspot hotspot--nabe btn-link" data-toggle="collapse" data-parent="#accordion" href="#collapse4">
      <span class="hotspot--title hotspot--title__right">Nabe</span>
    <span class="hotspot--cta"></span>
    </span>
  </section>
</div>


<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
  <div class="panel-group" id="accordion" role="tablist">
    <div class="panel panel-default">
      <div class="faq-panel-heading" id="heading1" role="tab">
        <h4 class="panel-title">
          <button class="btn btn-block faq collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse1" style="text-align:left; white-space:normal;" type="button" aria-expanded="false">Harz</button>
        </h4>
      </div>
      <div class="faq panel-collapse collapse" id="collapse1" role="tabpanel" aria-expanded="false" style="height: 0px;">
        <div class="panel-body">
          <p>some text</p>
        </div>
      </div>
    </div>
    <div class="panel panel-default">
      <div class="faq-panel-heading" id="heading2" role="tab">
        <h4 class="panel-title">
          <button class="btn btn-block faq collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse2" style="text-align:left; white-space:normal;" type="button" aria-expanded="false">Felge</button>
        </h4>
      </div>
      <div class="faq panel-collapse collapse" id="collapse2" role="tabpanel" aria-expanded="false" style="height: 0px;">
        <div class="panel-body">
          <p>some text</p>
        </div>
      </div>
    </div>
    <div class="panel panel-default">
      <div class="faq-panel-heading" id="heading3" role="tab">
        <h4 class="panel-title">
          <button class="btn btn-block faq collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse3" style="text-align:left; white-space:normal;" type="button" aria-expanded="false">Speichen</button>
        </h4>
      </div>
      <div class="faq panel-collapse collapse" id="collapse3" role="tabpanel" aria-expanded="false" style="height: 0px;">
        <div class="panel-body">
          <p>some text</p>
        </div>
      </div>
    </div>
    <div class="panel panel-default">
      <div class="faq-panel-heading" id="heading4" role="tab">
        <h4 class="panel-title">
          <button class="btn btn-block faq collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse4" style="text-align:left; white-space:normal;" type="button" aria-expanded="false">Name</button>
        </h4>
      </div>
      <div class="faq panel-collapse collapse" id="collapse4" role="tabpanel" aria-expanded="false" style="height: 0px;">
        <div class="panel-body">
          <p>some text</p>
        </div>
      </div>
    </div>
  </div>
</div>

Add data-toggle="collapse" href="#collapse2" to the links to open #collapse2. In order to prevent hashchange event firing, you can change the <a> element to another tag, for example '`

.btn-link {
  cursor: pointer
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>

<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
  <section class="hotspots--wrapper">
    <img src="/images/produktbeschreibung/wheel-585x.png" alt="" class="hotspots--figure">
    <span class="hotspot hotspot--harz btn-link" data-toggle="collapse" data-parent="#accordion" href="#collapse1">
      <span class="hotspot--title hotspot--title__right">Harz</span>
    <span class="hotspot--cta"></span>
    </span>
    <span class="hotspot hotspot--felge btn-link" data-toggle="collapse" data-parent="#accordion" href="#collapse2">
      <span class="hotspot--title">Felge</span>
    <span class="hotspot--cta"></span>
    </span>
    <span class="hotspot hotspot--speichen btn-link" data-toggle="collapse" data-parent="#accordion" href="#collapse3">
      <span class="hotspot--title hotspot--title__right">Speichen</span>
    <span class="hotspot--cta"></span>
    </span>
    <span class="hotspot hotspot--nabe btn-link" data-toggle="collapse" data-parent="#accordion" href="#collapse4">
      <span class="hotspot--title hotspot--title__right">Nabe</span>
    <span class="hotspot--cta"></span>
    </span>
  </section>
</div>


<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
  <div class="panel-group" id="accordion" role="tablist">
    <div class="panel panel-default">
      <div class="faq-panel-heading" id="heading1" role="tab">
        <h4 class="panel-title">
          <button class="btn btn-block faq collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse1" style="text-align:left; white-space:normal;" type="button" aria-expanded="false">Harz</button>
        </h4>
      </div>
      <div class="faq panel-collapse collapse" id="collapse1" role="tabpanel" aria-expanded="false" style="height: 0px;">
        <div class="panel-body">
          <p>some text</p>
        </div>
      </div>
    </div>
    <div class="panel panel-default">
      <div class="faq-panel-heading" id="heading2" role="tab">
        <h4 class="panel-title">
          <button class="btn btn-block faq collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse2" style="text-align:left; white-space:normal;" type="button" aria-expanded="false">Felge</button>
        </h4>
      </div>
      <div class="faq panel-collapse collapse" id="collapse2" role="tabpanel" aria-expanded="false" style="height: 0px;">
        <div class="panel-body">
          <p>some text</p>
        </div>
      </div>
    </div>
    <div class="panel panel-default">
      <div class="faq-panel-heading" id="heading3" role="tab">
        <h4 class="panel-title">
          <button class="btn btn-block faq collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse3" style="text-align:left; white-space:normal;" type="button" aria-expanded="false">Speichen</button>
        </h4>
      </div>
      <div class="faq panel-collapse collapse" id="collapse3" role="tabpanel" aria-expanded="false" style="height: 0px;">
        <div class="panel-body">
          <p>some text</p>
        </div>
      </div>
    </div>
    <div class="panel panel-default">
      <div class="faq-panel-heading" id="heading4" role="tab">
        <h4 class="panel-title">
          <button class="btn btn-block faq collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse4" style="text-align:left; white-space:normal;" type="button" aria-expanded="false">Name</button>
        </h4>
      </div>
      <div class="faq panel-collapse collapse" id="collapse4" role="tabpanel" aria-expanded="false" style="height: 0px;">
        <div class="panel-body">
          <p>some text</p>
        </div>
      </div>
    </div>
  </div>
</div>

通过锚点链接地址并打开引导手风琴

却一份温柔 2025-02-19 07:10:56

基于@henok T的解决方案,这是一个,没有 lodash

它是在打字稿中实现的,并使用样式的组件,但是可以通过简单地删除类型并添加样式内联的方式来轻松地适应香草JS。

import React, { useMemo } from "react";
import styled from "styled-components";

const MarkedText = styled.mark`
  background-color: #ffd580;
`;

interface IHighlighted { 
  text?: string;
  search?: string;
}

export default function Highlighted({ text = "", search = "" }: IHighlighted): JSX.Element {
  /**
   * The brackets around the re variable keeps it in the array when splitting and does not affect testing
   * @example 'react'.split(/(ac)/gi) => ['re', 'ac', 't']
   */
  const re = useMemo(() => {
    const SPECIAL_CHAR_RE = /([.?*+^$[\]\\(){}|-])/g;
    const escapedSearch = search.replace(SPECIAL_CHAR_RE, "\\$1");
    return new RegExp(`(${escapedSearch})`, "i");
  }, [search]);

  return (
    <span>
      {search === ""
        ? text
        : text
            .split(re)
            .filter((part) => part !== "")
            .map((part, i) => (re.test(part) ? <MarkedText key={part + i}>{part}</MarkedText> : part))}
    </span>
  );
}

Based on @Henok T's solution, here is one without lodash.

It is implement in Typescript and uses Styled-components, but can be easily adapted to vanilla JS, by simply removing the types and adding the styles inline.

import React, { useMemo } from "react";
import styled from "styled-components";

const MarkedText = styled.mark`
  background-color: #ffd580;
`;

interface IHighlighted { 
  text?: string;
  search?: string;
}

export default function Highlighted({ text = "", search = "" }: IHighlighted): JSX.Element {
  /**
   * The brackets around the re variable keeps it in the array when splitting and does not affect testing
   * @example 'react'.split(/(ac)/gi) => ['re', 'ac', 't']
   */
  const re = useMemo(() => {
    const SPECIAL_CHAR_RE = /([.?*+^$[\]\\(){}|-])/g;
    const escapedSearch = search.replace(SPECIAL_CHAR_RE, "\\$1");
    return new RegExp(`(${escapedSearch})`, "i");
  }, [search]);

  return (
    <span>
      {search === ""
        ? text
        : text
            .split(re)
            .filter((part) => part !== "")
            .map((part, i) => (re.test(part) ? <MarkedText key={part + i}>{part}</MarkedText> : part))}
    </span>
  );
}

使用ReactJ突出显示文本

却一份温柔 2025-02-19 02:44:04
  1. git stash(保存您的本地更改)
  2. git Checkout theotherbranchname(允许您更改ofc的分支)
  3. git stash stash pop您所在的地方,如果两个分支之间存在冲突,有时可能会导致合并)
  4. 将文件移动到需要的地方
  1. git stash (saves your local changes)
  2. git checkout theOtherBranchName (allows you to change branches ofc)
  3. git stash pop (sends your local changes saved in the place where you are, can sometimes cause a merge if there are conflicts between the 2 branches which is normal)
  4. Move your file where you needs

git-将文件从另一个分支获取到当前分支的特定文件夹

却一份温柔 2025-02-18 13:56:23

我不确定是否可能手动创建备份文件(您需要知道如何通过.VCF文件中的Contacts应用程序存储和读取数据),但是如果您只想提取并保存数据:

只需使用:只需使用: &gt;”符号,例如:

adb shell content query --uri content://com.android.contacts/contacts | wc -l > Contacts.txt

或(如果要指定路径),

adb shell content query --uri content://com.android.contacts/contacts | wc -l > /home/pi/Desktop/Contacts.txt

这将创建一个名为Contacts的文件(带有.txt格式),该文件保留命令输出

I'm not sure whether creating a backup file manually is possible (you would need to know how data is stored and read by the contacts app in .vcf files), but if you simply want to extract and save the data:

Simply use ">" sign, eg.:

adb shell content query --uri content://com.android.contacts/contacts | wc -l > Contacts.txt

or (if you want to specify a path)

adb shell content query --uri content://com.android.contacts/contacts | wc -l > /home/pi/Desktop/Contacts.txt

This will create a file named Contacts (with a .txt format) that holds the command output

如何存储ADB Shell的联系人? [安卓]

却一份温柔 2025-02-18 10:47:40

NBConvert似乎支持替代解决方案,您可以在其中将文件输出到-stdout 并将其对所需的文件夹进行了将类似的内容委托给所需的文件夹:

cmd = f'jupyter nbconvert --execute {filename}.ipynb --no-input --to html --stdout > ./path/to/dir/{report_name}.html'
os.system(cmd)

&gt;重定向将覆盖任何(and &gt;&gt;将附加到)与同一文件的现有文件在该位置的名称,因此您可能不需要第二个操作系统检查。

希望这会有所帮助。

nbconvert seems to support an alternative solution, where you might output your file to --stdout and redicted it to the desired folder something like so:

cmd = f'jupyter nbconvert --execute {filename}.ipynb --no-input --to html --stdout > ./path/to/dir/{report_name}.html'
os.system(cmd)

The > redirect would overwrite any (and >> would append to an) existing file with the same name in that location so you might not need that second os check later on.

Hope this helps.

Python Jupyter笔记本电脑ossystem / nbconvert路径更改

却一份温柔 2025-02-18 07:57:47

在可用之前,请勿访问数据。使用hasdatahaserror属性类似:

FutureBuilder<future type>(
  future: _future, // a previously-obtained Future
  builder: (BuildContext context, AsyncSnapshot<future type> snapshot) {
    if (snapshot.hasData) {
      // here snapshot.data is available
      return <hasData widget>
    } else if (snapshot.hasError) {
      return <hasError widget>
    } else {
      return <waiting widget>
    }
  }
)

Do not access data before it is available. Use hasData and hasError properties something like this:

FutureBuilder<future type>(
  future: _future, // a previously-obtained Future
  builder: (BuildContext context, AsyncSnapshot<future type> snapshot) {
    if (snapshot.hasData) {
      // here snapshot.data is available
      return <hasData widget>
    } else if (snapshot.hasError) {
      return <hasError widget>
    } else {
      return <waiting widget>
    }
  }
)

快照数据null但FutureBuilder返回数据?

却一份温柔 2025-02-17 05:02:36

尝试使用执行示例计算的for循环,但

# initialize new rows to zero
df['new u'] = 0
df['ext u'] = 0

# set first row cumsum
df['ext u'][0] = df['units'][0]//5

# loop through the data frame to perform the calculations
for i in range(1, len(df)):
    # calculate new units
    df['new u'][i] = (df['units'][i]-2*df['ext u'][i-1])//5
    # calculate existing units
    df['ext u'][i] = df['ext u'][i-1] + df['new u']

我不确定这些是您要寻找的 Exact 表达式,但希望这能使您能够进入解决方案。值得注意的是,这不会照顾整个“第一价值” 0的东西,因为(随意纠正我,但)似乎在此之前,您将添加零,这不会影响任何事情。希望这有帮助!

Try using a for loop that performs the sample calculation you provided

# initialize new rows to zero
df['new u'] = 0
df['ext u'] = 0

# set first row cumsum
df['ext u'][0] = df['units'][0]//5

# loop through the data frame to perform the calculations
for i in range(1, len(df)):
    # calculate new units
    df['new u'][i] = (df['units'][i]-2*df['ext u'][i-1])//5
    # calculate existing units
    df['ext u'][i] = df['ext u'][i-1] + df['new u']

I'm not certain that those are the exact expressions you are looking for, but hopefully this gets you on your way to a solution. Worth noting that this does not take care of the whole "first value > 0" thing because (feel free to correct me but) it seems like before that you will just be adding up zeros, which won't affect anything. Hope this helps!

基于从另一列获得的第一个值的暨创建新计算

却一份温柔 2025-02-17 04:54:49

使用Promise构造函数()。

const prefix = await new Promise((resolve, reject) =>
  client.db.get(SQL,
    (err, row) => err ? reject(err) : resolve(row.prefix)
  )
)

Use Promise constructor (mdn).

const prefix = await new Promise((resolve, reject) =>
  client.db.get(SQL,
    (err, row) => err ? reject(err) : resolve(row.prefix)
  )
)

等待使用sqlite的JS文件3

却一份温柔 2025-02-16 22:17:56

我找到了这个问题的解决方案,这确实是因为与DOM相比,Chrome扩展位于孤立的存储空间中。要访问该变量,我首先必须将脚本注入常规DOM,然后使用Chrome Messaging API将消息发送给我的注入脚本的消息,然后然后获取我要寻找的变量。希望这对别人有帮助。我可以看到为什么我的问题现在最初是作为重复的,但是我认为这可能会帮助某些人在反应时对这个特定问题感到困惑的人。

I found the solution to this question, it is indeed because the chrome extension is in isolated memory space compared to the DOM. To get access to that variable I first have to inject my script into the regular DOM and then use chrome messaging api to send a message to my injected script to THEN get the variables I'm looking for. Hopefully this helps someone else out. I can see why my question was initially closed now as a duplicate, but none the less I think this may help some people that get confused by this particular issue when it comes to react.

访问React Props&amp;通过本机JavaScript函数

却一份温柔 2025-02-16 21:05:12

如果您在云日志记录中看不到任何日志,可以在此处尝试此处的说明。 -logs“ rel =“ nofollow noreferrer”>文档关于如何查找和使用 - 使用云记录 并找到确保您正在收集GKE日志部分。

If you can't see any of your logs in Cloud Logging, you could try the instructions here in this document about How to find—and use—your GKE logs with Cloud Logging and find the Make sure you’re collecting GKE logs section.

如何查看GKE中的容器日志

却一份温柔 2025-02-16 17:41:33

我将用户和频道都映射到您感兴趣的属性 - .channelid.UID - 然后只使用.includes < /代码>两次,以查看两个值都包含在两个数组中。

const channelIds = data.channels.map(c => c.channelId);
const userIds = data.users.map(u => u.uId);
if (
  !channelIds.includes(channelId) ||
  !userIds.includes(authUserId)
) {
  return {
    error: 'error'
  };
}

可以将其放入一行,但读取性较低。 (从技术上讲,任何 javaScript代码都可以放入一条线上 - 但从可维护性的角度来看,这并不是一个好主意。)

if (!data.channels.map(c => c.channelId).includes(channelId) || !data.users.map(u => u.uId).includes(authUserId)) { return { error: 'error' };}

I'd map both the users and the channels to just the properties you're interested in - .channelId and .uid - and then just use .includes twice to see that both values are included in both arrays.

const channelIds = data.channels.map(c => c.channelId);
const userIds = data.users.map(u => u.uId);
if (
  !channelIds.includes(channelId) ||
  !userIds.includes(authUserId)
) {
  return {
    error: 'error'
  };
}

It's possible to put into a single line, but it's less readable. (Technically, any JavaScript code could be put into a single line - but that doesn't make it a good idea from a maintainability standpoint.)

if (!data.channels.map(c => c.channelId).includes(channelId) || !data.users.map(u => u.uId).includes(authUserId)) { return { error: 'error' };}

有什么方法可以更有效地循环浏览数组对象以检查函数参数中的错误吗?

却一份温柔 2025-02-16 13:19:26

插件&gt; XML工具&GT;选项然后在“ msxml功能”部分中的“禁止dtd = false”部分:

“ 86248“>在西班牙语中这个答案

Plugins > Xml Tools > Options then "Prohibit DTD=FALSE" in the "MSXML Features" section:

screenshot of location of the option

Taken from this answer in Spanish

在记事本上禁止使用DTD&#x2B;&#x2B;

却一份温柔 2025-02-15 12:35:06

两个 underscore.js lodash 是:

var ip = require('underscore')
    .chain(require('os').networkInterfaces())
    .values()
    .flatten()
    .find({family: 'IPv4', internal: false})
    .value()
    .address;

The correct one-liner for both Underscore.js and Lodash is:

var ip = require('underscore')
    .chain(require('os').networkInterfaces())
    .values()
    .flatten()
    .find({family: 'IPv4', internal: false})
    .value()
    .address;

获取Node.js中的本地IP地址

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文