错误配置或只是一个简单的监督? Dockerimage 中的 php mysql 连接器错误

我有这个 index.php index.php

这个连接.php connection.php

这篇文章.php article.php

和浏览器中的这个输出 output (at localhost:8080)

作为参考,这是我的整个设置: - 它是一个 docker 图像 - idk 如果数据库内容在其中,但我希望如此...

https://www.dropbox.com/s/aoxy8vj9z8cjtpw/ApacheExperiments.zip?dl=1

现在我没有看到想要的输出作为我的教程,我做错了什么

https://youtu.be/QNxU3Qa6QZs?t=708

指导我看?我想知道这个并修复它。

我不知道如何正确使用这里的文本框来粘贴 php 代码,所以请原谅我做截图..

我正在设置
https://ayoubb.com/technology/dockerize-apache-mysql-php-stack/

中提到的 docker 容器


然后我按照上面提到的第二个教程...

感谢您的支持


这里以纯文本形式开始代码

----------------------index.php

<?php

php phpinfo();
include_once('includes/connection.php');
include_once('includes/article.php');

$article = new Article;
$articles = $article->fetch_all();

print(articles);

?>
<html>
<head>
    <title>CMS Tutorial 
        <?php 
            echo time();
        ?>
    </title>
    <link rel="stylesheet" href="assets/styles.css"/>

</head>
<body>

    <div class="container">
    <a href="index.php" id="logo">cms</a>
    <ol>
    <li>
            <a href="article.php?id=1">Article Title</a> - <small> posted on date </small>
        </li>
    </ol>

</body>
</html>

article.php

<?php

    class Article {
        public function fetch_all() {
            global $pdo;
            #print($pdo);
            print("<br>");
    
            $query = $pdo->prepare("SELECT * FROM articles");
            print($query);
            $query->execute();
    
            #return $query->fetchAll();
        }
    }

?>

connection.php

<?php

php phpinfo();
include_once('includes/connection.php');
include_once('includes/article.php');

$article = new Article;
$articles = $article->fetch_all();

print(articles);

?>
<html>
<head>
    <title>CMS Tutorial 
        <?php 
            echo time();
        ?>
    </title>
    <link rel="stylesheet" href="assets/styles.css"/>

</head>
<body>

    <div class="container">
    <a href="index.php" id="logo">cms</a>
    <ol>
    <li>
            <a href="article.php?id=1">Article Title</a> - <small> posted on date </small>
        </li>
    </ol>

</body>
</html>

实际上我找到了 this,但这不是什么大帮助,因为我是网络新手...我来自德国哈哈

xu741852963 回答:错误配置或只是一个简单的监督? Dockerimage 中的 php mysql 连接器错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/14648.html

大家都在问