php - Cakephp + 用于 PHP 的 Visual Studio 工具

标签 php cakephp visual-studio-2013

我正在尝试使用适用于 Visual Studio (2013) 的 php 工具调试我的 cakephp 应用程序。

我做不到,当我尝试调试时它不考虑路由。

有人知道怎么做吗?

最佳答案

要使用 MS Visual Studio 2013 调试 cakephp 应用程序,我执行了这些步骤并且它对我来说工作正常:

  • 1 - 创建一个新的 PHP Web 项目。
  • 2 - 将您的(新创建的)cakephp 应用程序复制到 PHP Web 项目的目录,并将所有应用程序包含到其中。

所以你会得到这样的东西:

  • 3 - 然后我们将设置启动选项(从调试菜单 -> 项目属性或右键单击您的项目然后选择属性)。

对于调试,我们将使用 IIS Express,所以如果您还没有安装它,您可以通过 MS Web Platform Installer 从同一窗口安装它。 :

所以你会得到这样的东西:

  • 4 - 然后我们必须像提到的那样设置我们的 url 重写规则 here ,只需将 web.config 放在项目的根目录中即可:

web.config 内容:

<?xml version="1.0" encoding="UTF-8"?>
<configuration> 
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Exclude direct access to webroot/*"
                  stopProcessing="true">
                    <match url="^webroot/(.*)$" ignoreCase="false" />
                    <action type="None" />
                </rule>
                <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
                  stopProcessing="true">
                    <match url="^(img|css|files|js|favicon.ico)(.*)$" />
                    <action type="Rewrite" url="webroot/{R:1}{R:2}"
                      appendQueryString="false" />
                </rule>
                <rule name="Rewrite requested file/folder to index.php"
                  stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php"
                      appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

  • 5 - 按 F5(或调试 -> 开始调试):

然后

就是这样!

希望对您有所帮助。

关于php - Cakephp + 用于 PHP 的 Visual Studio 工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28648691/

相关文章:

c# - 自动实现的属性 setter 上的条件断点

php - 使用多个过滤器过滤数据时,只有选择一个特定过滤器后,所有过滤器才会显示数据

php - 查询以获取带或不带组连接的多行

php - 使用 PDO 更新数组

php - CakePHP 查找最近的日期

c# - Visual Studio C# 单元测试

php - 优化 sql 查询 PHP Phalcon

php - CakePHP 的用户管理、身份验证和 acl 插件?

mysql - CakePHP:虚拟字段可以在查找中使用吗?

c++ - 我在Visual Studio 2013中使用SDL 2.0.1时遇到LNK2019错误