目录
1 xampp
1.1 目录结构
D:\code_files\xampp\htdocs
1.1.1 项目位置
1.2 配置文件
1.2.1 项目访问端口
默认访问项目的端口80,输入地址localhost,直接进入项目的index.html页面
<VirtualHost *:8002>
ServerName localhost:8002
DocumentRoot "D:/code_files/xampp/htdocs/Artemis/WebApp/web/"
<Directory "D:/code_files/xampp/htdocs/Artemis/WebApp/web/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
1.3 配置php.ini
在测试环境可以配置不使用缓存
;opcache.revalidate_freq=0
支持简写
short_open_tag=On
日志级别
error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING
2 Xdebug
php必备的调试工具
2.1 xampp中配置Xdebug
[Xdebug]
zend_extension = D:\code_files\xampp\php\ext\php_xdebug.dll
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="PHPSTORM"
2.2 phpstrom中配置Xdebug
2.2.1 安装chrome调试插件Xdebug helper
Xdebug 需要用到插件 Xdebug helper
2.2.2 phpStorm配置Xdebug
2.2.3 断点调试 #debug
例子:
如果设置了断点,每次刷新项目页面后,会自动触发phpStorm的debug模式,除非取消侦听
2.2.4 js和php代码同时调试 #js #php
在php文件内,只能给php代码设置断点,调试php代码,无法给js设置断点
如果要对js代码进行调试,必须把js代码分离成单独的js文件,设置给js代码设置断点
如果js代码中有php代码,就替换成纯文本内容
http://localhost:8002/marketing-ali?XDEBUG_SESSION_START=11219
打开js debug和php debug监听器,可以同时进行php和js的debug