thinkphp6.0 的 nginx 伪静态配置
// thinkphp6.0 的nginx 伪静态配置
location / {
index index.php;
# thinkphp6.0 的 nginx 伪静态配置
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
// thinkphp6.0 的nginx 伪静态配置
location / {
index index.php;
# thinkphp6.0 的 nginx 伪静态配置
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
composer create-project laravel/laravel="8.*" laravel8
虽然平时开发都会用到, 但是突然要回答这个怎么形容倒是一下恶心到了我, 记录一下比较官方的回答吧
变量 : 变量是用来储存数据的容器, php使用$符号来定义变量
常量 : 常量可以理解为不变的量。常量被定义后,在脚本的其他任何地方都不能改变和删除。一个常量由英文字母、下划线和数学组成。但数字不能作为首字母出现, 在PHP中使用define()函数来定义常量
数组 : 数组是一种用于存储和操作多个值的数据结构,是一个有序的集合,其中每个值都有一个唯一的键来标识它。数组可以包含不同类型的值,包括字符串、整数、浮点数、布尔值、对象和其他数组
万圣节...不快乐
//使用方法:$sql = ''; $data = db_switch('you db','select * from tb','2');
function db_switch($db,$sql,$type='2',$utf='utf8'){
if (empty($sql))
die('sql is empty');
switch ($db) {
case 'your database name':
return db_connect(ip,user,passwd,db,$sql,$type,$utf);
break;
default:
echo 'please enter you db_name,like bm、shop、live。';
}
}
function db_connect($ip,$root,$pass,$db,$sql,$type,$utf){
$db = @mysqli_connect($ip,$root,$pass,$db) or die("Error " . mysqli_error($link));
$db->set_charset($utf);
$data = $db->query($sql);
$res = array();
if ($type=='1'){//查询一条数据
$res = $data->fetch_assoc();
}elseif($type=='2'){//查询多条
$res = $data->fetch_all(MYSQLI_ASSOC);
}elseif ($type=='3'){//更新和删除
$res = $db->affected_rows;
}
$db->close();
return $res;
}
explain显示了mysql如何使用索引来处理select语句以及连接表。可以帮助选择更好的索引和写出更优化的查询语句。
使用方法,在select语句前加上explain就可以了,如:
explain select * from statuses_status where id=11;
hostnamectl set-hostname xxx
igbinary
https://windows.php.net/downloads/pecl/releases/igbinary/3.2.6/
redis
https://windows.php.net/downloads/pecl/releases/redis/5.3.7rc1/
git
https://registry.npmmirror.com/binary.html?path=git-for-windows/v2.40.0.windows.1/
laravel8 文档
https://learnku.com/docs/laravel/8.x
原文地址:在线工具
#!/bin/env bash
# =================================================
# Author: renwole.com #
# See: https://renwole.com/archives/2215 #
# Description: MySQL automatic installation tool #
# =================================================
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
Install_MySQL() {
# CentOS 8 mysql: error while loading shared libraries: libncurses.so.5
yum install ncurses ncurses-compat-libs -y
# Install dependencies
setenforce 0
yum -y install epel-release
yum -y install wget tar jemalloc jemalloc-devel gcc gcc-c++
# MySQL configuration
mysql_version="8.0.27"
mysql_password="nd.mm#2021"
mkdir -p /apps/server/mysql/data
mysql_install_dir="/apps/server/mysql"
mysql_data_dir="/apps/server/mysql/data"
download_mysql="https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads"
# Download MySQL
cd /mnt
useradd -M -s /sbin/nologin mysql >/dev/null 2>&1
wget -c ${download_mysql}/MySQL-8.0/mysql-${mysql_version}-linux-glibc2.12-x86_64.tar.xz
echo "========== Start installing MySQL ============"
tar xJf mysql-${mysql_version}-linux-glibc2.12-x86_64.tar.xz
\mv mysql-${mysql_version}-linux-glibc2.12-x86_64/* ${mysql_install_dir}
if [[ -d "${mysql_install_dir}/support-files" ]]; then
rm -rf mysql-${mysql_version}-linux-glibc2.12-x86_64
else
rm -rf ${mysql_install_dir}
echo "Error: MySQL install failed, Please contact the author"
kill -9 $$
fi
# Initialize the database
${mysql_install_dir}/bin/mysqld --initialize-insecure --user=mysql --lower-case-table-names=1 --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
chown -R root . ${mysql_install_dir}
chown -R mysql.mysql ${mysql_data_dir}
\cp -f ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld
sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld
sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld
sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/lib64/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
echo 'PATH=$PATH:'${mysql_install_dir}'/bin' >/etc/profile.d/mariadb_renwole.com.sh
# my.conf configuration
cat > /etc/my.cnf << EOF
[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8mb4
[mysql]
prompt="MySQL [\\d]> "
no-auto-rehash
[mysqld]
port = 3306
socket = /tmp/mysql.sock
default_authentication_plugin = mysql_native_password
basedir = ${mysql_install_dir}
datadir = ${mysql_data_dir}
pid-file = ${mysql_data_dir}/mysql.pid
user = mysql
bind-address = 0.0.0.0
server-id = 1
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4
collation-server = utf8mb4_0900_ai_ci
lower-case-table-names = 1
skip-name-resolve
#skip-networking
back_log = 300
max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 500M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
ft_min_word_len = 4
log_bin = mysql-bin
binlog_format = mixed
binlog_expire_logs_seconds = 604800
log_error = ${mysql_data_dir}/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = ${mysql_data_dir}/mysql-slow.log
performance_schema = 0
explicit_defaults_for_timestamp
lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
[mysqldump]
quick
max_allowed_packet = 500M
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M
EOF
# Set up MySQL
chmod 600 /etc/my.cnf
chmod +x /etc/init.d/mysqld
systemctl enable mysqld
systemctl start mysqld
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "create user root@'127.0.0.1' identified by \"${mysql_password}\";"
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'127.0.0.1' with grant option;"
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'localhost' with grant option;"
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "alter user root@'localhost' identified by \"${mysql_password}\";"
${mysql_install_dir}/bin/mysql -uroot -p${mysql_password} -e "reset master;"
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona,alisql}*.conf
echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/mysql_renwole.com.conf
ldconfig
echo "========== MySQL installing Successfully ====="
echo
echo "=============================================="
echo " Thank you for using Renwole.com script"
echo "=============================================="
echo "MySQL:"
echo "account: root"
echo "password: ${mysql_password}"
echo "database: ${mysql_data_dir}"
echo "=============================================="
}
Install_MySQL
source /etc/profile