PHP in python through bash

As I am messing around with Python, I wanted to write an application that would have its own web server. I am currently using a written code from this website for http server: Python Web Server and this is the direct link of the script This script can handle html but I wanted to add php to it too. Since I know that in Ubuntu I can run php commands within the terminal, I wanted to implement th

通过bash在python中使用PHP

当我搞乱Python的时候,我想编写一个应用程序,它将拥有自己的Web服务器。 我目前正在使用来自本网站的书面代码用于http服务器:Python Web服务器,这是脚本的直接链接 这个脚本可以处理html,但我也想添加php。 因为我知道在Ubuntu中我可以在终端中运行php命令,所以我想对这个脚本实现相同的逻辑。 我添加了这些行: import os os.system('php '+filepath) 然而,我的计划没有按照计划进行......“ <? echo 'hel

Include PHP inside JavaScript (.js) files

I have a JavaScript file (extension .js , not .html ) containing several JavaScript functions. I want to call one of the PHP functions in a PHP file containing only several PHP functions from within one of the JavaScript functions. Is that possible? Would I need to "include" the .php file containing the PHP function in the .js file? How would I do that? For example, say I had

将PHP包含在JavaScript(.js)文件中

我有一个包含多个JavaScript函数的JavaScript文件(扩展名为.js ,不是.html )。 我想在一个PHP函数中调用其中一个PHP函数,该函数仅包含一个JavaScript函数中的几个PHP函数。 那可能吗? 我是否需要在.js文件中“包含”包含PHP函数的.php文件? 我会怎么做? 例如,假设我有一个名为myLib.php的文件,其中包含一个名为myFunc的函数,它具有两个参数( param1和param2 )。 然后我有一个包含名为myJsFunc的函数的.js文

get data from URL without having variables

This question already has an answer here: Get the full URL in PHP 28 answers The superglobal $_SERVER['PATH_INFO'] contains all the parts of the URL path after the script. So if the user goes to: welcom.com/index.php/NewYork-NY/Driver $_SERVER['PATH_INFO'] will contain /NewYork-NY/Driver .

从URL获取数据而不需要变量

这个问题在这里已经有了答案: 以PHP 28的答案获取完整的URL 超全局$_SERVER['PATH_INFO']包含脚本之后的URL路径的所有部分。 所以如果用户去: welcom.com/index.php/NewYork-NY/Driver $_SERVER['PATH_INFO']将包含/NewYork-NY/Driver 。

PHP not printing current URL

This question already has an answer here: Get the full URL in PHP 28 answers You are mistaking $_SERVER['REQUEST_URI'] for $_GET['url'] $_GET['URL'] is a get statment .. Meaning you need to pass a variable through the URL IE http://example.com?URL=myurl To get the current URL .. Simply use echo $_SERVER['REQUEST_URI']; $_GET will get you the get parameter

PHP不打印当前的URL

这个问题在这里已经有了答案: 以PHP 28的答案获取完整的URL 您错误$_SERVER['REQUEST_URI']作为$_GET['url'] $_GET['URL']是一个get语句。意思是你需要通过URL传递一个变量IE http://example.com?URL=myurl 要获取当前的URL,只需使用echo $_SERVER['REQUEST_URI']; $_GET会让你获取参数,而不是整个网址。 使用$_SERVER['REQUEST_URI'] 。

PhP script to know the current URL

This question already has an answer here: Get the full URL in PHP 28 answers 您必须为当前主机名称使用HTTP_HOST: - http://'.$_SERVER['HTTP_HOST']

PhP脚本知道当前的URL

这个问题在这里已经有了答案: 以PHP 28的答案获取完整的URL 您必须为当前主机名称使用HTTP_HOST: - http://'.$_SERVER['HTTP_HOST']

I can't get full url path

This question already has an answer here: Get the full URL in PHP 28 answers So you want to read out lang from the url params? if (!isset($_GET['lang']) || $_GET['lang'] == 'en') echo "ENGLISH"; else echo "DE"; If you just want to get the query string, to use in a link, use: echo $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']; Or to remove the ? when there is no query string: e

我无法获得完整的网址路径

这个问题在这里已经有了答案: 以PHP 28的答案获取完整的URL 所以你想从url params中读出lang ? if (!isset($_GET['lang']) || $_GET['lang'] == 'en') echo "ENGLISH"; else echo "DE"; 如果您只想获取查询字符串,以便在链接中使用,请使用: echo $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']; 或者删除? 当没有查询字符串时: echo $_SERVER['PHP_SELF'] . ($_SERVER['QUERY_STRING']!=''?'?':'') .

How to Get Current Browser URL in php?

This question already has an answer here: Get the full URL in PHP 28 answers $_SERVER['REQUEST_URI'] For more details on what info is available in the $_SERVER array, see the PHP manual If you also need the query string (the bit after the ? in a URL), that part is in this variable: $_SERVER['QUERY_STRING'] Use GET to get the value of id . You don't need to use $_SERVER['PHP_SELF&

如何在PHP中获取当前浏览器URL?

这个问题在这里已经有了答案: 以PHP 28的答案获取完整的URL $_SERVER['REQUEST_URI'] 有关$_SERVER数组中可用信息的更多详细信息,请参阅PHP手册 如果您还需要查询字符串(位于URL中的?之后的位),则该部分位于此变量中: $_SERVER['QUERY_STRING'] 使用GET获取id的值。 您不需要使用$ _SERVER ['PHP_SELF']。 $id = $_GET['id']; 你可以试试这个代码function curPageURL() { $pageURL = 'http';

GET a URL parameter with PHP

This question already has an answer here: GET URL parameter in PHP 8 answers Get the full URL in PHP 28 answers 您可以使用php Super Global变量$ _GET轻松捕获lang变量的值: $lang = $_GET['lang']; echo $lang; It is better to pass the URL parameters using add_query_var, and get the parameter using get_query_var. Because, they can handdle the set, and get of multiple parameters, and is the rec

使用PHP获取URL参数

这个问题在这里已经有了答案: 在PHP 8中的GET参数答案 以PHP 28的答案获取完整的URL 您可以使用php Super Global变量$ _GET轻松捕获lang变量的值: $lang = $_GET['lang']; echo $lang; 最好使用add_query_var传递URL参数,并使用get_query_var获取参数。 因为,他们可以手动设置,并获得多个参数,并且是将URL作为参数传递的推荐方式。

Reading URL in php

This question already has an answer here: Get the full URL in PHP 28 answers The thing you want is Subdomain of your url. Use this $subdomain = array_shift(explode(".",$_SERVER['HTTP_HOST'])); $domain = $_SERVER['HTTP_HOST']; $path = $_SERVER['SCRIPT_NAME']; $queryString = $_SERVER['QUERY_STRING']; $url = "http://" . $domain . $path . "?" . $queryString; echo "The current URL is: " . $url

在php中读取URL

这个问题在这里已经有了答案: 以PHP 28的答案获取完整的URL 你想要的东西是你的网址的子域名。 用这个 $subdomain = array_shift(explode(".",$_SERVER['HTTP_HOST'])); $domain = $_SERVER['HTTP_HOST']; $path = $_SERVER['SCRIPT_NAME']; $queryString = $_SERVER['QUERY_STRING']; $url = "http://" . $domain . $path . "?" . $queryString; echo "The current URL is: " . $url . ""; visit :http://www.2basetech

Get full website URL?

This question already has an answer here: Get the full URL in PHP 28 answers What about this? $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; Note that you could also do: $actual_link = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; Original answer: https://stackoverflow.com/a/6768831/3150271

获取完整的网站网址?

这个问题在这里已经有了答案: 以PHP 28的答案获取完整的URL 那这个呢? $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; 请注意,你也可以这样做: $actual_link = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; 原始答案:https://stackoverflow.com/a/6768831/3150271