通过悟空crm 学习thinkphp

2019-07-10  本文已影响0人  邪恶的奥伯伦
  1. 在项目首页编辑php.info 写入以下内容, 即可通过浏览器查看php系统信息,比如说查看加在php.ini文件的位子
<?php
phpinfo();
 ?>
Screenshot from 2019-07-10 14-41-21.png
  1. pip.ini的加载
    目录的位子 /usr/local/etc/
    在php目录下默认有php.ini-development与php.ini-production
    拷贝php.ini-production 命名为php.ini , 这样在php程序重启重新加载后, 就会成功加载php.ini文件
    可以通过php.info调试界面查看。

  2. docker-compose文件

version: "3"
services:
web:
image: nginx
ports:
- "80:80"
volumes:
- ./project:/var/www/html/project
- ./default.conf:/etc/nginx/conf.d/default.conf
- ./nginx.conf:/etc/nginx/nginx.conf
- ./log/nginx:/var/log/nginx
networks:
- webnet
php:
image: zfw/php:5.6-fpmv1
volumes:
- ./project:/var/www/html/project
- ./php.conf:/usr/local/etc
networks:
- webnet
mysql:
image: mysql:5.6
ports:
- "33306:3306"
volumes:
- ./mysql:/var/lib/mysql
restart: always
environment:
- TZ=Asia/Shanghai
- MYSQL_ROOT_PASSWORD=mysql
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
networks:
- webnet
networks:
webnet:

  1. 在php.ini中修改上传文件的大小限制

post_max_size = 50M ; Maximum size of POST data that PHP will accept.
upload_max_filesize = 50M ; Maximum allowed size for uploaded files.

  1. 悟空crm thinkphp的Dockerfile, 增加了上传文件等模块

FROM php:5.6-fpm
RUN apt-get update
RUN docker-php-ext-install mysql mysqli
RUN apt-get install -y --force-yes --no-install-recommends less libxml2-dev
RUN docker-php-ext-install soap
RUN apt-get install -y zlib1g-dev
RUN rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install zip

  1. api 路由
    比如一个api url 为 http://localhost:8071/index.php?m=contract&a=edit
    m表示模块 对应为 App/Lib/Action/XXXAction.classs.php, 根据api XXX为Contract
    a表示action 表示改php文件中定义的function名字为edit
上一篇下一篇

猜你喜欢

热点阅读