我们有一个Laravel应用程序(版本5.4.18),它连接到MySQL(5.6.38)数据库(总共300k行),MyISAM类型.我们有api-response之类的Model::with('anothermodel')->paginate(25)
,并且在某些时候这个查询的执行时间已达到18秒,这是非常大的价值.我创建了一个沙盒,其中包含使用exaclty相同数据库(在同一服务器上)的副本的实时laravel环境,现在这个api-response在2.5秒内执行.如果我们尝试将沙盒laravel连接到实时DB,那么api执行再次是18s.请检查图像.
因此,如果我们假设问题出现在实时网站的数据库表中,但如果我们尝试用这个查询来衡量microtime
,那么它将显示生成此查询并从数据库中获取数据所需的时间仅为0.7秒.
因此,如果我们假设问题出现在API路由或Laravel代码中,但是如果我只是将其复制到子目录(作为沙箱),那么执行相同的代码没有任何问题.
有任何想法吗?
还有一些服务器信息:Linux服务器上的PHP 7.0.29,内存为32GB.
我有一个容器元素,它包含一些其他元素,但根据屏幕尺寸,它们的部分在不同部分莫名其妙地被切断。当 HTML 页面的宽度调整时(通过单击并拖动它),您可以观察我的代码沙箱链接上的行为。如何确保只呈现主容器边框,而子元素没有任何影响?
https://codesandbox.io/s/focused-tree-ms4f2
import React from "react";
import styled from "styled-components";
const StyledTextBox = styled.div`
height: 15vh;
width: 30vw;
display: flex;
flex-direction: column;
margin: 0 auto;
border: 1px solid black;
background-color: #fff;
> * {
box-sizing: border-box;
}
`;
const InputBox = styled.span`
height: 35%;
width: 100%;
display: flex;
border: none;
outline: none;
`;
const UserInput = styled.input`
height: 100%;
width: 90%;
border: none;
outline: none;
`;
const SolutionBox = styled.div`
height: 35%;
width: 100%;
border: none;
outline: none; …
Run Code Online (Sandbox Code Playgroud) 我正在使用谷歌地图自动完成脚本,它的工作正常,但如果用户没有从下拉列表中选择任何人,如何清除输入?
例如:当前情况:用户输入"新建"并在列表中看到"纽约",但不要选择它(点击输入外的任何地方),现在intup的值为"新".我想:用户输入"新建"并在列表中看到"纽约",但不要选择它(点击输入外的任何地方),现在intup有空值,因为未选择列表中的任何内容.
我目前的代码:
<input id="autocomplete2" placeholder="Enter your address" onFocus="initAutocomplete2()" type="text">
<script>
function initAutocomplete2() {
autocomplete2 = new google.maps.places.Autocomplete(
/** @type {!HTMLInputElement} */(document.getElementById('autocomplete2')),
{types: ['(cities)']});
}
</script>
Run Code Online (Sandbox Code Playgroud) 如何通过产品ID获取包含订单ID的阵列?
我的意思是接收所有特定产品的订单.
我知道如何通过MySQL做到这一点,但有没有办法通过WP_Query
函数来做到这一点?
javascript ×2
autocomplete ×1
css ×1
database ×1
jquery ×1
laravel ×1
myisam ×1
mysql ×1
orders ×1
performance ×1
php ×1
product ×1
reactjs ×1
woocommerce ×1
wordpress ×1