我有一个codeignte项目,我用codeignite 3.1.11和php7.1升级了我的项目,一切都很好,但我的自定义路径不起作用。但我的老项目这条路线运行良好。请检查我的代码并给我一些解决方案。我正在尝试,因此可能会更改我的访问和路由。我使用的配置uri协议是请求uri
这是我的roue.php
$url = $_SERVER['REQUEST_URI'];
$url = explode('/',$url);
$url=end($url);
$secondlasturl = explode('/',$_SERVER['REQUEST_URI']);
$controller = $secondlasturl[1];
$second_url = $secondlasturl[2];
if(isset($secondlasturl[3])){
$third_url = $secondlasturl[3];
}else{
$third_url='';
}
//$min=explode('-',$second_url1);
$con = mysqli_connect('localhost','root','','mydb');
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
if($url!=''){
$sql = 'select CompanyID, shorturl, BusinessType from lxn_companies where shorturl ="'.$url.'"';
$res=mysqli_query($con, $sql);
if(mysqli_fetch_assoc($res))
{
$row = mysqli_fetch_row($res);
//print_r($row);
$type = $row[2];
if($type=='Exporters')
{
$userlink = 'ExporterDetail/'.$row[0];
}
else
{
$userlink = 'ImporterDetail/'.$row[0];
}
$route['(:any)'] = "user/".$userlink."";
}
else
{
$sql = 'select CompanyID, sef_url, BusinessType from lxn_companies where sef_url ="'.$url.'"';
$res=mysqli_query($con, $sql);
if(mysqli_num_rows($res)>0)
{
$row = mysqli_fetch_row($res);
//print_r($row);
$type = $row[2];
if($type=='Exporters')
{
$userlink = 'ExporterDetail/'.$row[0];
}
else
{
$userlink = 'ImporterDetail/'.$row[0];
}
$route['(.*)'] = "user/".$userlink."";
}
}
}
我正在为我的项目使用此htacess代码。
选项+在rewriterule^([a-z0-9-]+).html$index.php/page/$1[l]rewritecond%{request\u filename}上跟随Symlinks rewriteengine-f rewritecond%{request_filename}-d重写秒1美元^(index.php | asset | robots.txt)rewriterule^(.*)$index.php?/$1[qsa,l]#php--开始cpanel生成的处理程序,不要编辑#将“ea-php71”包设置为默认的“php”编程语言。addhandler应用程序/x-httpd-ea-php71.php.php7.phtml
暂无答案!
目前还没有任何答案,快来回答吧!