Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 相对路径还是绝对路径_Php_Path_Relative Path_Absolute Path - Fatal编程技术网

Php 相对路径还是绝对路径

Php 相对路径还是绝对路径,php,path,relative-path,absolute-path,Php,Path,Relative Path,Absolute Path,在我的localhost xampp中,我在htdocs中有一个名为“google”的文件夹,在这个文件夹中有两个名为client.php和server3f.php的文件 因此,我在client.php中给出了这个路径,以连接我的server3f.php文件及其在本地主机中的工作 var host= ws://localhost:12346/google/server3f.php 现在我把这个文件夹“google”上传到我的远程服务器上的public_html目录下。现在我应该给出什么路径?

在我的localhost xampp中,我在htdocs中有一个名为“google”的文件夹,在这个文件夹中有两个名为client.php和server3f.php的文件

因此,我在client.php中给出了这个路径,以连接我的server3f.php文件及其在本地主机中的工作

var host= ws://localhost:12346/google/server3f.php
现在我把这个文件夹“google”上传到我的远程服务器上的public_html目录下。现在我应该给出什么路径? 我试过了

   var host= ws://www.xyz.com:12346/google/server3f.php

但它们都不起作用

我能够使用此路径在“google”文件夹中动态创建页面

 "/home/pocket/public_html/google/

请帮帮我。我应该走哪条路?:)

您没有显示如何使用“host”变量。但这里有一些提示:

如果您正在同一url(在./google中有一个文档根目录)中生成链接,则两者都可以工作,例如

<a href="http://www.xyz.com:12346/google/server3f.php">Visit mygoogle.com</a>

<a href="server3f.php">Visit mygoogle.com</a>

如果要在一台服务器上生成链接,并希望它连接到另一台服务器,则需要完整地址(上面的选项1)

如果您的文档根是htdocs,那么您的本地路径将是:

<a href="./google/server3f.php">Visit mygoogle.com</a>

当然,这假设您在服务器上正确设置和/或端口转发端口:12346

<a href="./google/server3f.php">Visit mygoogle.com</a>