【问题标题】:PhpStorm print the script of php instead of html pagePhpStorm 打印 php 的脚本而不是 html 页面
【发布时间】:2021-02-13 18:57:31
【问题描述】:

我正在本地服务器上开发一个使用 HTML/PHP/CSS/SQL 生成 CV 的项目。当我使用 chrome 选项在 PHPStorm 上运行 php 文件时,它会打印两个 php 标签之间的代码,而不是 html 页面。它从今天开始,在此之前一切都很好。

  <html lang="fr">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
    <title>Page d'inscription</title>
    <link rel="stylesheet" href="style.css">

</head>
<body>
<div class="grid-container">
    <div class = "carre_acceuil">
        <div class = "titre_acceuil">
            Inscription
        </div>
        <form method="post" action="inscrire.php">
            <div class = "formulaire_acceuil">
                <label>
                    <input type = "text" name = "prenom" placeholder="Prenom" required class="input_acceuil"><br><br>
                    <input type = "text" name = "nom" placeholder ="Nom" required class="input_acceuil"><br><br>
                    <input type = "email" name = "email" placeholder ="Adresse email" required class="input_acceuil"><br><br>
                    <input type = "password" name = "password" placeholder ="Mot de passe" required class="input_acceuil"><br><br>
                </label>
                <input type="submit" value="S'inscrire" class="bouton">
            </div>
        </form>
    </div>
</div>
</body>

文件“inscrire.php”在这里:

 <?php
$nom = $_POST["nom"];
$nom = ucfirst(strtolower($nom));
$prenom = $_POST["prenom"];
$prenom = ucfirst(strtolower($prenom));
$email = $_POST["email"];
$password = crypt($_POST["password"]);

//se connecter a la base de donee
$bdd = new PDO("mysql:host=localhost;dbname=ifd1_gestion_cv;charset=utf8", "root", "");

// Créer une requête INSERT INTO pour insérer un étudiant
$req = $bdd->prepare("INSERT INTO comptes (nom, prenom, email, password) VALUES (?,?,?,?);");

// Exécuter la requête
$req->execute([ucfirst($nom), ucfirst($prenom), $email, $password]);

header("Location: index.php");

?>

【问题讨论】:

  • 如果您要获得帮助,您需要显示一些代码
  • 有什么变化吗?本地服务器更改,php更新还是其他?
  • @Svetoslav 我刚刚拉了最后一个版本,但我的朋友有相同的版本,也使用 phpmyadmin 和 phpstorm,它适用于他们
  • 如果您看到的是 php 文件的代码而不是预期的输出,则说明您的 php 没有被解释。我不知道 PhpStorm 打印脚本是什么意思。您是否在 PhpStorm 中使用在浏览器中打开链接?如果是这样,我从未使用过,所以我不确定,但可能与 Languages & Frameworks > PHP > Cli interpreter 中配置的解释器有关。
  • @JulienB。我只是在想同样的问题,在重新阅读问题时,它实际上是关于 phpstorm 中的设置,而不是代码问题。

标签: php html sql google-chrome phpstorm


【解决方案1】:

更新,我卸载了phpstorm并重新安装了它,现在它可以工作了,谢谢大家!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-11
    • 2014-04-20
    • 1970-01-01
    • 2020-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多