简体   繁体   English

如何通过ftp和PHP连接到localhost?

[英]How do I connect to localhost via ftp wth PHP?

Should be an easy question but I don't really have an understanding of how servers work. 应该是一个简单的问题,但是我对服务器的工作方式并不真正了解。 I am using MAMP/Apache and I'm trying to use this command on PHP: 我正在使用MAMP / Apache,并且尝试在PHP上使用以下命令:

$conn_id=ftp_connect($ftp_server);

then, 然后,

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

It works to type in my URL, username and password to connect to the remote server hosted on dreamhost, but how do I connect to the local host for testing purposes? 它可以键入我的URL,用户名和密码来连接到托管在dreamhost上的远程服务器,但是如何连接到本地主机以进行测试? What exactly is my server called? 我的服务器究竟叫什么? And what do I put for username and password? 我该为用户名和密码输入什么?

Thanks! 谢谢!

MAMP doesn't come with a built-in FTP server. MAMP没有内置的FTP服务器。 If you want to simulate a FTP connection locally, you can use the FTP server that comes with OS X. MAMP does offer a step by step tutorial how to use it: 如果要在本地模拟FTP连接,则可以使用OS X随附的FTP服务器。MAMP确实提供了逐步使用方法的教程:

How to: Access FTP with MAMP 如何:使用MAMP访问FTP

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM