Support the ongoing development of Laravel.io →
Requests Input Views
Last updated 2 years ago.
0
<a href = "{{Request::fullUrl()}} + &status=open">Open Status</a>
0

I want to smart function Laravel. It is very simple

This example function manual PHP

function add_var_to_url($variable_name,$variable_value,$url_string){
	// first we will remove the var (if it exists)
	// test if url has variables (contains "?")
	if(strpos($url_string,"?")!==false){
		$start_pos = strpos($url_string,"?");
		$url_vars_strings = substr($url_string,$start_pos+1);
		$names_and_values = explode("&",$url_vars_strings);
		$url_string = substr($url_string,0,$start_pos);
		foreach($names_and_values as $value){
			list($var_name,$var_value)=explode("=",$value);
			if($var_name != $variable_name){
				if(strpos($url_string,"?")===false){
					$url_string.= "?";
				} else {
					$url_string.= "&";
				}
				$url_string.= $var_name."=".$var_value;
			}
		}
	} 
	if(strpos($url_string,"?")===false){
		$url_string .= "?".$variable_name."=".$variable_value;
	} else {
		$url_string .= "&".$variable_name."=".$variable_value;
	}
	return $url_string;
}
Last updated 9 years ago.
0

Don't fully understand question, but have a look:

$areturn = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo "<br>";

$haystack = $areturn;
$needle   = '?';
$pos      = strripos($haystack, $needle);
if ($pos === false) {
    $areturn = $areturn."?p=1&t1=".$t1;
    Session::put('areturn', $areturn);
    
} else {
   
    Session::put('areturn', $areturn);
}
echo "here is a return:  ".Session::get('areturn');
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.