Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.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 未在元属性中显示完整url=";og:url";_Php_Codeigniter_Metadata - Fatal编程技术网

Php 未在元属性中显示完整url=";og:url";

Php 未在元属性中显示完整url=";og:url";,php,codeigniter,metadata,Php,Codeigniter,Metadata,我试图在og:url的内容中传递函数current_url()中的变量 <meta property="og:url" content="[full url here]"> 控制器: public function jobdetails(){ $this->load->library('get_url'); $data['cur_url'] = $this-&

我试图在og:url的内容中传递函数current_url()中的变量

 <meta property="og:url" content="[full url here]">
控制器:

public function jobdetails(){           
            $this->load->library('get_url');
            $data['cur_url'] = $this->get_url->current_url();           
            $this->load->view('head', $data, TRUE);
}
视图:

$\u服务器['REQUEST\u URI']中所述
返回

为访问此页面而提供的URI;例如, “/index.html”

您希望添加查询的参数,因此还应该添加
query\u字符串
,您可以使用相同的方式访问该字符串:

$_SERVER['QUERY_STRING']
这会回来的

用于访问页面的查询字符串(如果有)

class Get_url{

        public function current_url(){
        
            $protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
            $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
            return $url;
          }
}    
public function jobdetails(){           
            $this->load->library('get_url');
            $data['cur_url'] = $this->get_url->current_url();           
            $this->load->view('head', $data, TRUE);
}
<meta property="og:url" content="<?php echo $cur_url; ?>">
$_SERVER['QUERY_STRING']