小编Rob*_*ari的帖子

MacOS Laravel Valet 增加 memory_limit

我尝试使用 Laravel 代客增加 php 的 memory_limit。

我所看到的:

使用phpinfo()我看到:

  • memory_limit 128M
  • 配置文件(php.ini)路径 /usr/local/etc/php/7.4
  • 加载的配置文件 /usr/local/etc/php/7.4/php.ini
  • 扫描此目录以获取 /usr/local/etc/php/7.4/conf.d其他 .ini 文件 解析的其他 .ini 文件 /usr/local/etc/php/7.4/conf.d/ext-opcache.ini, /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini

我已经在做的

  • 我更新php.iniphp-memory-limit.ini以将 memory_limit 从 128M 编辑为 256M:memory_limit = 256M

  • 然后我运行了以下命令: valet restart

  • 我也尝试编辑 /usr/local/etc/php/7.4/php-fpm.d/valet-fpm.conf 添加 php_admin_value[memory_limit] = 256M

  • 但在那之后 memory_limit 坚持到 128M ( with phpinfo() )

以下命令返回 256M: php -i | grep memory_limit

知道如何增加这个值吗?

php laravel-valet

7
推荐指数
3
解决办法
6255
查看次数

在新版本的 chrome(108) 之后,从我的应用程序打印时会添加一个额外的空白页。我怎样才能删除它?

它在 Microsoft Edge 上运行良好。

以下内容在一页上进行。然而,该项目的核心存在这个错误。

@media print {
    html, body {
        height: 100vh;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
}

Run Code Online (Sandbox Code Playgroud)

打印某些页面时,不会在最后一页添加空白页。

html css printing google-chrome version

6
推荐指数
2
解决办法
5714
查看次数

nuxt auth :Google 提供商返回 invalid_request

我尝试使用 Nuxt Auth 模块设置谷歌身份验证,但我从谷歌收到以下错误:

Error 400 : invalid_request
Parameter not allowed for this message type: nonce
Run Code Online (Sandbox Code Playgroud)

这是我的配置

Error 400 : invalid_request
Parameter not allowed for this message type: nonce
Run Code Online (Sandbox Code Playgroud)

以及我如何在我的组件中调用 google auth:

// nuxt.config.js
modules: ["@nuxtjs/axios", "@nuxtjs/auth-next"],
auth: {
  router: {
    middleware: ["auth"],
  },
  redirect: {
    login: "/login",
    logout: "/",
    callback: false,
    home: "/",

  },
  strategies: {
         google: { clientId: "MyClientID", codeChallengeMethod: "" }
  }
}
Run Code Online (Sandbox Code Playgroud)

我也尝试从这里运行官方演示:https : //github.com/nuxt-community/auth-module/tree/dev/demo 但我遇到了同样的错误。

javascript vue.js nuxt.js nuxtjs nuxt-auth

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

具有自定义域的 WSL 主机文件

我创建了一个基本的 Express 应用程序

const express = require('express');

const app = express();

app.get("*", (req, res) => {;
  res.contentType('html');
  res.send("HELLO FROM WSL");
});
const port = 80
app.listen(port);
Run Code Online (Sandbox Code Playgroud)

然后我添加以下条目c:\windows\system32\drivers\etc\hosts

127.0.0.1        custom.local
Run Code Online (Sandbox Code Playgroud)

然后我关闭 wslwsl --shutdown并重新打开以启动我的 Express 应用程序。

如果我从 WSL ( cat /etc/hosts) 检查主机文件,我得到以下结果

# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateHosts = false
127.0.0.1       localhost
127.0.1.1       LAPTOP-ZECKA.localdomain        LAPTOP-ZECKA
127.0.0.1       custom.local
Run Code Online (Sandbox Code Playgroud)

然后我去http://custom.local …

hosts windows-subsystem-for-linux wsl-2

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

用父类包裹子scss文件

有没有办法将父类添加到子 scss 文件中的所有规则中。通过将子文件解释为已经编译过?

目前,我尝试@import用父类包装 an ,但它没有按预期工作。

父级.scss

.parent{
   @import 'child';
}
Run Code Online (Sandbox Code Playgroud)

孩子.scss

.child{
   .dark &{
      color: blue;
   }
}
Run Code Online (Sandbox Code Playgroud)

实际产量

.parent{
   @import 'child';
}
Run Code Online (Sandbox Code Playgroud)

预期产出

.child{
   .dark &{
      color: blue;
   }
}
Run Code Online (Sandbox Code Playgroud)

css sass

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

Next.js 如何忽略应用程序中的完整文件夹?

在接下来的 13 日,当 nextConfig.output 为“export”时,app/api 文件夹会在构建期间创建错误。

在我的项目中,我需要根据环境变量使用不同的构建类型。

当“输出”为“导出”时,有什么方法可以在构建过程中忽略“api”文件夹吗?

当我使用 nextConfig.output 作为“导出”运行构建时,出现以下错误:

导出在以下路径上遇到错误:/api/revalidate/route:/api/revalidate

src/app/api/revalidate/route.ts 文件

import { NextRequest, NextResponse } from 'next/server';
import { revalidateTag } from 'next/cache';
 
export async function GET(request: NextRequest) {
  const tag = request.nextUrl.searchParams.get('tag');
  if(tag){
    revalidateTag(tag);
  }
  return NextResponse.json({ revalidated: true, now: Date.now() });
}
Run Code Online (Sandbox Code Playgroud)

Next.config.js

import { NextRequest, NextResponse } from 'next/server';
import { revalidateTag } from 'next/cache';
 
export async function GET(request: NextRequest) {
  const tag = request.nextUrl.searchParams.get('tag');
  if(tag){
    revalidateTag(tag);
  }
  return NextResponse.json({ revalidated: true, now: …
Run Code Online (Sandbox Code Playgroud)

javascript next.js static-site-generation

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

Woocommerce获得当前的运输区域

我创建了一个自定义送货方式.(https://docs.woocommerce.com/document/shipping-method-api/)

在calculate_shipping函数中,我想根据出货区域设置我的送货方式的价格:

如果运输区域为"区域1",则将价格设置为15,否则将价格设置为20

所以我想知道,我怎样才能获得当前的运输区?

我已经尝试看到这个文档:https://docs.woocommerce.com/wc-apidocs/class-WC_Shipping_Zone.html 也许我不明白......

public function calculate_shipping( $package=Array()) {
            global $woocommerce;

            $cart_total=$woocommerce->cart->cart_contents_total;


            $current_hour=date('His');
            $start_hour='110000';
            $end_hour='210000';

            // CONDITIONAL CHECK 

                // OPEN HOUR
                if($current_hour >= $start_hour &&  $current_hour <= $end_hour){
                    $is_open=true;
                }else{
                    $is_open=false;
                }

                // price PER ZONE
                $zone=""; // need to know how to get zone name or zone id
                if($zone=='Zone 1' && $cart_total>='60'){
                    $min_order=true;
                    $cost = 6;
                }elseif($zone=='Zone 2' && $cart_total>='120'){
                    $min_order=true;
                    $cost = 8;
                }elseif($zone=='Zone 3' && $cart_total>='180'){
                    $min_order=true;
                    $cost = 9; …
Run Code Online (Sandbox Code Playgroud)

php wordpress shipping woocommerce

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

Laravel 代客更改 php 版本在 mac os 上不起作用

我尝试更改代客使用的 PHP 版本,因此我执行以下命令:

valet use php@7.4
Run Code Online (Sandbox Code Playgroud)

代客返回成功信息: Valet is now using php@7.4.

但是如果我在 .test 网站上使用 phpinfo() ,我会看到 php 在 7.3 中。

我以这种方式多次更改了 php 版本,它始终有效。我现在不明白怎么回事...

laravel-valet

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