lamp架构介绍及环境搭建

本文详细介绍了lamp架构的工作流程和环境搭建步骤,包括安装httpd、mysql、php,以及配置apache的代理模块和虚拟主机,最后进行验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

lamp架构介绍及环境搭建


1. web工作流程

通过上面的图说明一下web的工作流程:

  • 客户端通过http协议请求web服务器资源
  • web服务器收到请求后判断客户端请求的资源是静态资源或是动态资源
    • 若是静态资源则直接从本地文件系统取之返回给客户端。
    • 否则若为动态资源则通过FastCGI协议与php服务器联系,通过CGI程序的master进程调度worker进程来执行程序以获得客户端请求的动态资源,并将执行的结果通过FastCGI协议返回给httpd服务器,httpd服务器收到php的执行结果后将其封装为http响应报文响应给客户端。在执行程序获取动态资源时若需要获得数据库中的资源时,由Php服务器通过mysql协议与MySQL/MariaDB服务器交互,取之而后返回给httpd,httpd将从php服务器收到的执行结果封装成http响应报文响应给客户端。

2.lamp平台构建


环境说明:

系统平台IP需要安装的服务
centos8
redhat8
192.168.223.153httpd-2.4.54
mysql-5.7.38
php
php-mysql

lamp平台软件安装次序:

httpd --> mysql --> php

注意:php要求httpd使用prefork MPM

2.1 安装httpd

//YUM源配置

[root@localhost ~]# yum -y install vim wget make
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# ls
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-08-02 08:44:02--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 43.224.184.230, 43.224.184.231, 45.253.17.211, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|43.224.184.230|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d 100%[==========>]   2.44K  --.-KB/s    in 0.002s  

2022-08-02 08:44:02 (1.53 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]# cd
[root@localhost ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
CentOS-8.5.2111 - Base - mirrors.aliyun.com            15 kB/s | 3.9 kB     00:00    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com         4.9 kB/s | 1.5 kB     00:00    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com       42 kB/s | 4.3 kB     00:00    
epel-release-latest-8.noarch.rpm                      164 kB/s |  24 kB     00:00    
Dependencies resolved.
[root@localhost yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@localhost yum.repos.d]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*

//安装开发工具包

[root@localhost ~]# yum groups mark install 'Development Tools'
Extra Packages for Enterprise Linux Modular 8 - x86_6 629 kB/s | 1.0 MB     00:01    
Extra Packages for Enterprise Linux 8 - x86_64        8.3 MB/s |  13 MB     00:01   
.....
Is this ok [y/N]: y
Complete!

//创建apache服务的用户和组

[root@localhost ~]# useradd -r -M -s /sbin/nologin -g apache apache 

//安装依赖包

[root@localhost ~]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++
Last metadata expiration check: 0:03:02 ago on Tue 02 Aug 2022 08:17:10 PM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Package libtool-2.4.6-25.el8.x86_64 is already installed.
Package gcc-8.4.1-1.el8.x86_64 is already installed.
Package gcc-c++-8.4.1-1.el8.x86_64 is already installed.
Dependencies resolved.
.....
  zlib-devel-1.2.11-17.el8.x86_64         
Complete!

/下载和安装apr以及apr-util

[root@localhost src]#  wget https://downloads.apache.org/apr/apr-1.6.5.tar.bz2
--2022-08-03 10:30:32--  https://downloads.apache.org/apr/apr-1.6.5.tar.bz2
Resolving downloads.apache.org (downloads.apache.org)... 135.181.214.104, 88.99.95.219, 2a01:4f9:3a:2c57::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|135.181.214.104|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 855393 (835K) [application/x-bzip2]
Saving to: ‘apr-1.6.5.tar.bz2’

apr-1.6.5.tar.bz2 100%[==========>] 835.34K   121KB/s    in 7.6s    

2022-08-03 10:30:41 (110 KB/s) - ‘apr-1.6.5.tar.bz2’ saved [855393/855393]

[root@localhost src]# wget https://downloads.apache.org/apr/apr-util-1.6.1.tar.bz2
--2022-08-03 10:31:50--  https://downloads.apache.org/apr/apr-util-1.6.1.tar.bz2
Resolving downloads.apache.org (downloads.apache.org)... 88.99.95.219, 135.181.214.104, 2a01:4f9:3a:2c57::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 428595 (419K) [application/x-bzip2]
Saving to: ‘apr-util-1.6.1.tar.bz2’

apr-util-1.6.1.ta 100%[==========>] 418.55K   304KB/s    in 1.4s    

2022-08-03 10:31:52 (304 KB/s) - ‘apr-util-1.6.1.tar.bz2’ saved [428595/428595]
[root@localhost src]# tar xf apr-1.6.5.tar.bz2 
tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[root@localhost src]#  yum -y install bzip2
[root@localhost src]# tar xf apr-1.6.5.tar.bz2 
[root@localhost src]# cd apr-1.6.5
[root@localhost apr-1.6.5]# vim configure
    cfgfile=${ofile}T
    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
#    $RM "$cfgfile"   把这行注释掉或者删掉
[root@localhost apr-1.6.5]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.6.5]# make && make install
[root@localhost apr-1.6.5]# cd /usr/src/
[root@localhost src]# tar xf apr-util-1.6.1.tar.bz2 
[root@localhost src]# cd apr-util-1.6.1/
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make && make install

//编译安装httpd

[root@localhost ~]# cd /usr/src
[root@localhost src]# wget https://downloads.apache.org/httpd/httpd-2.4.54.tar.bz2
[root@localhost src]# cd httpd-2.4.54/
[root@localhost httpd-2.4.54]# ./configure --prefix=/usr/local/apache \ 
> --sysconfdir=/etc/httpd24 \		#指定htttpd配置文件位置
> --enable-so \		#开启共享模块
> --enable-ssl \	#开启安全模块
> --enable-cgi \	#开启cgi传输协议
> --enable-rewrite \		#开启重写功能
> --with-zlib \		
> --with-pcre \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util/ \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork		#指定工作模型
......
    Server Version: 2.4.54
    Install prefix: /usr/local/apache
    C compiler:     gcc
    CFLAGS:          -g -O2 -pthread  
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE  
    LDFLAGS:           
    LIBS:             
    C preprocessor: gcc -E
[root@localhost httpd-2.4.54]# make && make install

//安装后配置

[root@localhost ~]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh
[root@localhost ~]# source /etc/profile.d/httpd.sh
[root@localhost ~]# echo $PATH
[root@localhost ~]# ln -s /usr/local/apache/include/ /usr/include/httpd
[root@localhost ~]# vim /etc/man_db.conf
MANDATORY_MANPATH                       /usr/man
MANDATORY_MANPATH                       /usr/share/man
MANDATORY_MANPATH                       /usr/local/share/man
MANDATORY_MANPATH                       /usr/local/apache/man #添加

取消ServerName前面的注释

[root@localhost ~]# vim /etc/httpd24/httpd.conf
....
ServerName www.example.com:80  #取消此行注释
....
[root@localhost ~]# httpd -t
Syntax OK

//启动apache

[root@localhost ~]# cd /usr/lib/systemd/system
[root@localhost system]# cp sshd.service httpd.service
[root@localhost system]# vim httpd.service 
[root@localhost system]# cat httpd.service 
[Unit]
Description=httpd server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start		  #修改为apachectl路径
ExecStop=/usr/local/apache/bin/apachectl stop		#修改为apachectl路径
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@localhost system]# systemctl daemon-reload
[root@localhost system]# systemctl start httpd.service 
[root@localhost system]# systemctl enable httpd.service 
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

关闭防火墙

[root@localhost ~]# systemctl start firewalld
[root@localhost ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# vim /etc/selinux/config
SELINUX=disabled
[root@localhost ~]# setenforce 0

2.2安装mysql

//安装依赖包

[root@localhost ~]# yum -y install ncurses-devel openssl-devel openssl cmake
Complete! 

//创建用户和组

[root@localhost ~]# useradd -M -s /sbin/nologin -r mysql
[root@localhost ~]# id mysql
uid=993(mysql) gid=990(mysql) groups=990(mysql)

//下载二进制格式的mysql软件包

[root@localhost ~]# cd /usr/src/
[root@localhost ~]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz		#下载mysql包

//解压软件至/usr/local/

[root@localhost src]#  tar xf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz -C /usr/local
[root@localhost src]# cd /usr/local/
[root@localhost local]#  ln -sv mysql-5.7.38-linux-glibc2.12-x86_64/ mysql
'mysql' -> 'mysql-5.7.38-linux-glibc2.12-x86_64/'

//修改目录/usr/local/mysql的属主属组

[root@localhost local]#chown -R mysql.mysql mysql	
[root@localhost local]# chown -R mysql.mysql mysql-5.7.38-linux-glibc2.12-x86_64/
[root@localhost local]# ll | grep mysql
lrwxrwxrwx.  1 mysql mysql  36 Aug  3 14:34 mysql -> mysql-5.7.38-linux-glibc2.12-x86_64/
drwxr-xr-x.  9 mysql mysql 129 Aug  3 14:33 mysql-5.7.38-linux-glibc2.12-x86_64

//添加环境变量

[root@localhost ~]# echo 'export PATH=$PATH:/usr/local/mysql/bin' > /etc/profile.d/mysql.sh
[root@localhost ~]# source /etc/profile.d/mysql.sh
[root@localhost ~]# echo $PATH
/usr/local/apache/bin:/usr/local/apache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin

//建立数据存放目录

[root@localhost mysql]# mkdir /opt/data
[root@localhost mysql]# chown -R mysql.mysql /opt/data/

//初始化数据库

root@localhost ~]# mysqld --initialize --user=mysql --datadir=/opt/data/
2022-08-03T07:39:52.618511Z 1 [Note] A temporary password is generated for root@localhost: )fJvn0mFop?U  #密码
[root@localhost ~]# echo ')fJvn0mFop?U' > password

配置mysql

[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve
[root@localhost ~]# cd /usr/local/mysql/support-files/		
[root@localhost support-files]# cp -a  mysql.server /etc/init.d/mysqld		#配置启动脚本
[root@localhost support-files]# vim /etc/init.d/mysqld 	
***省略部分输出***
basedir=/usr/local/mysql
datadir=/opt/data
***省略部分输出***

启动mysql

[root@localhost ~]# cd /usr/lib/systemd/system
[root@localhost system]# cp sshd.service mysqld.service
[root@localhost system]# vim mysqld.service
[root@localhost system]# cat mysqld.service 
[Unit]
Description=mysqld server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
ExecStart=/etc/init.d/mysqld start
ExecStop=/etc/init.d/mysqld stop
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@localhost system]# systemctl daemon-reload
[root@localhost system]# systemctl start mysqld
[root@localhost system]# systemctl enable mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.

//修改密码
//使用临时密码登录
//设置新密码

[root@localhost ~]# dnf install -y ncurses-compat-libs
[root@localhost ~]# mysql -uroot -p')fJvn0mFop?U' 
mysql> set password = password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

2.3安装php

//安装依赖包

[root@localhost ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel lib
curl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel pcre-devel
freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt lib
xslt-devel mhash mhash-devel php-mysqlnd		#安装依赖包

//下载php

[root@localhost ~]# cd /usr/src/
[root@localhost ~]# wget https://www.php.net/distributions/php-7.4.30.tar.xz

//编译安装php

[root@localhost ~]# cd /usr/src/
[root@localhost src]# tar xf php-7.4.30.tar.xz
[root@localhost src]# cd php-7.4.30
[root@localhost php-7.4.30]# ./configure --prefix=/usr/local/php7  \		#开始配置
--with-config-file-path=/etc \
--enable-fpm \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-openssl \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif  \
--enable-ftp \
--enable-gd \
--with-jpeg \
--with-zlib-dir \
--with-freetype \
--with-gettext \
--enable-json \
--enable-mbstring \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix

#以下为报错解决
报错:
configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
Package ‘sqlite3’, required by ‘virtual:world’, not found
解决:
[root@localhost php-7.4.30]# yum -y install sqlite-devel
报错:
error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
解决:
[root@localhost php-7.4.30]# dnf -y install libzip-devel
报错:
configure: error: Package requirements (oniguruma) were not met:
Package ‘oniguruma’, required by ‘virtual:world’, not found
解决:
[root@localhost php-7.4.30]# dnf -y install  http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm
每一次解决完报错之后都要再执行一遍配置过程,直到不再报错,最终效果如下:
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE. By continuing this installation  |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.  //php可以使用

//安装后配置

[root@localhost php-7.4.30]#  make && make install                  
[root@localhost php-7.4.30]# echo "export PATH=$PATH:/usr/local/php7/bin" > /etc/profile.d/php.sh
[root@localhost php-7.4.30]# source /etc/profile.d/php.sh 
[root@localhost php-7.4.30]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/apache/bin:/usr/local/mysql/bin:/root/bin:/usr/local/php7/bin
[root@localhost php-7.4.30]# echo "/usr/local/php7/lib" > /etc/ld.so.conf.d/php.conf
[root@localhost php-7.4.30]# cd
[root@localhost ~]#  ln -s /usr/local/php7/include/ /usr/include/php7
[root@localhost ~]# cd php-7.4.30
[root@localhost php-7.4.30]# php -v
PHP 7.4.30 (cli) (built: Aug  5 2022 07:41:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

//配置php-fpm

[root@localhost php-7.4.30]# cp php.ini-production /etc/php.ini 
cp: overwrite '/etc/php.ini'? y
[root@localhost php-7.4.30]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost php-7.4.30]# chmod +x /etc/init.d/php-fpm
[root@localhost php-7.4.30]# cd /usr/local/php7/etc/
[root@localhost etc]#  cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# cd php-fpm.d/
[root@localhost php-fpm.d]# cp www.conf.default www.conf

//启动php-fpm

[root@localhost php-fpm.d]# cd /usr/lib/systemd/system
[root@localhost system]#  cp sshd.service php-fpm.service
[root@localhost system]# vim php-fpm.service
[Unit]
Description=OpenSSH server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
ExecStart=/etc/init.d/php-fpm start
ExecStop=/etc/init.d/php-fpm stop
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@localhost system]# systemctl daemon-reload 
//设置开启自启
[root@localhost system]# systemctl start php-fpm.service 
[root@localhost system]# systemctl enable   php-fpm.service 
Synchronizing state of php-fpm.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.

2.4 配置apache


2.4.1 启用代理模块

//启用httpd的相关模块

[root@localhost ~]# vim /etc/httpd24/httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
2.4.2 配置虚拟主机

在需要使用fcgi的虚拟主机中添加类似如下两行:

ProxyRequests Off //关闭正向代理
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/PATH/TO/DOCUMENT_ROOT/$1

例如:

ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/var/www/html/idfsoft.com/$1

以上设置表示把以.php结尾的文件请求发送到php-fpm进程,php-fpm至少需要知道运行的目录和URI,所以这里直接在fcgi://127.0.0.1:9000后指明了这两个参数,其它参数的传递已经被mod_proxy_fcgi.so进行了封装,不需要手动指定。

注意:

这里写的/var/www/html/是yum源安装方式生成的网页存放目录,这里必须改成你编译安装指定的网页存放路径,禁止直接复制我这里的路径
这里的idfsoft.com是域名,你必须改成你所使用的域名,禁止直接复制此处的域名
这里的$1表示匹配所有以.php结尾的http请求
配置虚拟主机

[root@localhost ~]#  mkdir /usr/local/apache/htdocs/yhm
[root@localhost ~]#  vim /usr/local/apache/htdocs/yhm/index.php
<?php
   phpinfo();
?>
[root@localhost ~]# chown -R apache.apache /usr/local/apache/htdocs/
[root@localhost ~]# vim /etc/httpd24/httpd.conf
# Virtual hosts
Include /etc/httpd24/extra/httpd-vhosts.conf    #取消这一行的注释,表示启用该配置文件
[root@localhost ~]# vim /etc/httpd24/extra/httpd-vhosts.conf
<VirtualHost *:80>
    DocumentRoot "/usr/local/apache/htdocs/yhm"
    ServerName www.Archer.com
    ProxyRequests Off
    ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/Archer/$1
    <Directory "/usr/local/apache/htdocs/yhm">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>
[root@localhost ~]# vim /etc/httpd24/httpd.conf 
#搜索gzip.gz.tgz
  AddType application/x-compress .Z
  AddType application/x-gzip .gz .tgz
  AddType application/x-httpd-php .php		#添加这行
  AddType application/x-httpd-php-source .phps  #添加这行
#搜索dir_module
<IfModule dir_module>
    DirectoryIndex index.html index.php    #修改此行
</IfModule>

2.5 验证

修改电脑hosts文件
请添加图片描述

关闭防火墙

[root@localhost system]# systemctl stop firewalld
[root@localhost system]# systemctl disable firewalld
[root@localhost system]# vim /etc/selinux/config
SELINUX=disabled
[root@localhost system]# setenforce 0

启动

[root@localhost ~]# apachectl start
httpd (pid 212943) already running
[root@localhost ~]# apachectl stop
[root@localhost ~]# apachectl start

ip地址访问

请添加图片描述

域名访问

请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值