在我的代码PHP面包屑中更改名称 [英] Change names in my code PHP breadcrumbs

查看:58
本文介绍了在我的代码PHP面包屑中更改名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一点帮助,我在php中有一个面包屑,我的目录是这样的



I need a little help here i have a breadcrumbs in php, my directory is like this

folder/name.php





并使用此代码我得到这样的输出





and using this code i get on output like this

Home » folder » name





我想做的是把我想要的名字而不是代码得到名字的文件夹和文件。请帮帮我。谢谢你们



我的鳕鱼在下面:



我尝试了什么:





what i want to do is to put name that i want instead of the code gets the name of folder and file. please help me in this. thanks guys

my cod is below:

What I have tried:

<?php 
    $path = $_SERVER["PHP_SELF"];
    $parts = explode('/',$path);
    if (count($parts) < 2)
    {
    echo("home");
    }
    else
    {
    echo ("<a href=\"/\">Home</a> » ");
    for ($i = 1; $i < count($parts); $i++)
        {
        if (!strstr($parts[$i],"."))
            {
            echo("<a href=\"");
            for ($j = 0; $j <= $i; $j++) {echo $parts[$j]."/";};
            echo("\">". str_replace('-', ' ', $parts[$i])."</a> » ");
            }
        else
            {
            $str = $parts[$i];
            $pos = strrpos($str,".");
            $parts[$i] = substr($str, 0, $pos);
            echo str_replace('-', ' ', $parts[$i]);
            };
        };
    };  
?>

推荐答案

path =


_SERVER [PHP_SELF] ;
_SERVER["PHP_SELF"];


parts = explode('/',
parts = explode('/',


这篇关于在我的代码PHP面包屑中更改名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆