但是,如果您有兴趣学习,这里有很多开源 Web 应用程序。尝试在 Github 中搜索用 PHP 编写的项目。阅读其他人的代码绝对是个好主意,而且我相信如果您知道在哪里寻找,您可以找到一些现实世界代码的出色示例。此外,如果您提出良好的要求,出于安全原因,网站所有者可能愿意与您共享部分源代码,尽管可能不是全部。问一下也没什么坏处。
It is only possible if the site's owner intentionally makes the code publicly available, or if the site has a very critical security hole. Usually, no, you cannot read other people's server-side code.
After all, we'd have huge problems if you could just read any server-side code you wanted. If, say, a bank's website were built in PHP, it would be important that raw PHP files could not be read by the public: they might contain private data like database passwords, or simply make it much, much easier to find other key security issues, since, after all, which is easier—finding problems with code you can see, or code you can't see? As much as I am a fan of open-source coding, I would not put my money in any bank that makes its source code available. It's just too risky.
However, if you're interested in learning, there are plenty of open-source web applications out there. Try searching Github for, say, projects written in PHP. It's definitely a good idea to read other people's code, and I'm sure you could find some stellar examples of real-world code if you know where to look. Additionally, if you ask nicely, a website owner may be willing to share parts of the source code with you, though probably not all of it, for security reasons. Couldn't hurt to ask.
As long a website is not open source (which is not going to happen), NO, you cannot see the PHP code of any page. Except, as noted, the site is badly coded or ...
发布评论
评论(8)
只有当网站所有者有意公开代码,或者网站存在非常严重的安全漏洞时,才有可能实现这一点。通常,不,你无法读取其他人的服务器端代码。
毕竟,如果您只能读取您想要的任何服务器端代码,我们就会遇到巨大的问题。比如说,如果一家银行的网站是用 PHP 构建的,那么公众无法读取原始 PHP 文件就很重要:它们可能包含数据库密码等私有数据,或者只是使查找其他关键安全性变得非常非常容易问题,因为毕竟,哪个更容易——用你能看到的代码发现问题,还是用你看不到的代码发现问题?尽管我是开源编码的粉丝,但我不会把钱存入任何提供其源代码的银行。实在是太冒险了。
但是,如果您有兴趣学习,这里有很多开源 Web 应用程序。尝试在 Github 中搜索用 PHP 编写的项目。阅读其他人的代码绝对是个好主意,而且我相信如果您知道在哪里寻找,您可以找到一些现实世界代码的出色示例。此外,如果您提出良好的要求,出于安全原因,网站所有者可能愿意与您共享部分源代码,尽管可能不是全部。问一下也没什么坏处。
It is only possible if the site's owner intentionally makes the code publicly available, or if the site has a very critical security hole. Usually, no, you cannot read other people's server-side code.
After all, we'd have huge problems if you could just read any server-side code you wanted. If, say, a bank's website were built in PHP, it would be important that raw PHP files could not be read by the public: they might contain private data like database passwords, or simply make it much, much easier to find other key security issues, since, after all, which is easier—finding problems with code you can see, or code you can't see? As much as I am a fan of open-source coding, I would not put my money in any bank that makes its source code available. It's just too risky.
However, if you're interested in learning, there are plenty of open-source web applications out there. Try searching Github for, say, projects written in PHP. It's definitely a good idea to read other people's code, and I'm sure you could find some stellar examples of real-world code if you know where to look. Additionally, if you ask nicely, a website owner may be willing to share parts of the source code with you, though probably not all of it, for security reasons. Couldn't hurt to ask.
这是不可能的,除非您在他们的网站上拥有正确的访问权限[权限],或者您可以破解服务器:)
it's not possible, except if you have the right access [permission] on their sites to do so, or you can hack the server :)
不,PHP只是服务器端,源代码不会传递给客户端。
No. PHP is only server-side, and the source is not passed to client.
没有软件可以为您获取代码。要求网站所有者出于教育目的查看它是最好的方法。
There is no software that will get the code for you. Asking the website owner to see it for educational purposes is the best way.
除非网站提供商允许您知道,否则不可能判断人们甚至在后端使用了 php。
It is not possible to tell that people are even using php at all in their back end unless the site provider allows you to know that.
只要网站不是开源的(这不会发生),就不能看到任何页面的 PHP 代码。除非,如前所述,该网站编码错误或......
As long a website is not open source (which is not going to happen), NO, you cannot see the PHP code of any page. Except, as noted, the site is badly coded or ...
如果其他网站确实允许下载他们的代码,您可以:
但就像其他人所说的那样,这种情况发生的可能性极小。
If the other site does make their code downloadable you can:
But like every one else said, it is highly unlikely that this will happen.
是的,你可以这样做,但不建议参见 http://php.net/manual/ en/function.include.php
yes you can do that but it is not recommended see http://php.net/manual/en/function.include.php