zoukankan      html  css  js  c++  java
  • XAMPP + PhpStorm + Xdebug本地实验环境搭建

    参考:

    下载合适的XDebug

    点击这里,选择合适xdebug

    XAMPP配置

    php_xdebug-xxxx.dll

    拷贝dll至 D:XAMPPphpext

    php.ini

    文末追加

    [XDebug]
    zend_extension = "D:XAMPPphpextphp_xdebug-2.7.0RC2-7.3-vc15.dll"
    xdebug.profiler_append = 0
    xdebug.profiler_enable = 0
    xdebug.profiler_enable_trigger = 0
    xdebug.profiler_output_dir = "d:xampp	mp"
    ;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
    xdebug.remote_enable = 1
    xdebug.remote_handler = "dbgp"
    xdebug.remote_host = "127.0.0.1"
    xdebug.remote_log="d:xampp	mpxdebug.txt"
    xdebug.remote_port = 9000
    xdebug.trace_output_dir = "d:xampp	mp"
    ; 3600 (1 hour), 36000 = 10h
    xdebug.remote_cookie_expire_time = 36000
    xdebug.idekey="PhpStorm"

    Stop/Start Apache

    检查xdebug是否安装成功

    方法1:运行 http://localhost/dashboard/phpinfo.php 并检查xdebug

    方法2:php -m 并检查xdebug

    PHPStorm配置

    xdebug相应配置

    • 打开phpStorm,进入File>Settings>PHP>Servers,这里要填写服务器端的相关信息,name填localhost,host填localhost,port填80,debugger选XDebug
    • 进入File>Settings>PHP>Debug,看到XDebug选项卡,port填9000,其他默认
    • 进入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 PHPSTORM,host 填localhost,port 填80
    • 点OK退出设置

    PHPstorm项目配置

    指定PHP intepreter

    指定项目部署位置

    浏览器配置

    在适当浏览器上安装插件,这里

    以Chrome为例,安装完插件后如图

     

    测试xdebug

    实验代码

    orderform.html

    <html>
    <head><title>Bob's Auto Parts</title></head>
    <body>
    <form action="processorder.php" method="post">
    <table border="0">
    <tr bgcolor="#cccccc">
      <td width="150">Item</td>
      <td width="15">Quantity</td>
    </tr>
    <tr>
      <td>Tires</td>
      <td align="center"><input type="text" name="tireqty" size="3"
         maxlength="3" /></td>
    </tr>
    <tr>
      <td>Oil</td>
      <td align="center"><input type="text" name="oilqty" size="3" 
         maxlength="3" /></td>
    </tr>
    <tr>
      <td>Spark Plugs</td>
      <td align="center"><input type="text" name="sparkqty" size="3"
         maxlength="3" /></td>
    </tr>
    <tr>
      <td>How did you find Bob's?</td>
      <td><select name="find">
            <option value = "a">I'm a regular customer</option>
            <option value = "b">TV advertising</option>
            <option value = "c">Phone directory</option>
            <option value = "d">Word of mouth</option>
          </select>
      </td>
    </tr>
    <tr>
      <td colspan="2" align="center"><input type="submit" value="Submit Order" /></td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    View Code

    processorder.php

    <html>
    <head>
      <title>Bob's Auto Parts - Order Results</title>
    </head>
    <body>
    <h1>Bob's Auto Parts</h1>
    <h2>Order Results</h2>
    <?php
      echo '<p>Order processed at ';
      echo date('H:i, jS F');
      echo '</p>';
      echo '<p>Your order is as follows: </p>';
      echo $tireqty.' tires<br />';
      echo $oilqty.' bottles of oil<br />';
      echo $sparkqty.' spark plugs<br />';
    
      $totalqty = 0;
      $totalamount = 0.00;
    
      $totalqty = 0;
      $totalqty = $tireqty + $oilqty + $sparkqty;
      echo 'Items ordered: '.$totalqty.'<br />';
    
      $totalamount = 0.00;
    
      define('TIREPRICE', 100);
      define('OILPRICE', 10);
      define('SPARKPRICE', 4);
    
      $totalamount = $tireqty * TIREPRICE
                   + $oilqty * OILPRICE
                   + $sparkqty * SPARKPRICE;
    
      echo 'Subtotal: $'.number_format($totalamount,2).'<br />';
    
      $taxrate = 0.10;  // local sales tax is 10%
      $totalamount = $totalamount * (1 + $taxrate);
      echo 'Total including tax: $'.number_format($totalamount,2).'<br />';
    
    ?>
    </body>
    </html>
    View Code

    调试演示

    在PHP中打断点,浏览器触发断点

  • 相关阅读:
    6.25作业
    博客园第一篇
    532. 数组中的K-diff数对
    echarts
    跨域问题
    数组中第三大的数 leetcode 414
    除自身以外数组的乘积leetcode 238
    xshell工具
    插入、删除和随机查询时间复杂度都为O(1) leetcode 381
    组合总和3 leetcode 216
  • 原文地址:https://www.cnblogs.com/kelamoyujuzhen/p/10424651.html
Copyright © 2011-2022 走看看