php失败url编码器

I have link http://localhost:8081/intranet/slipgaji/2013/1-2013/2013.05.1557.pdf I will mask URL in address bar with put the code

if ($file == $profile->profile['nip'] . '.pdf') {
    $url_gaji = sprintf($path . "/" . $file);
    $search = array('1-', '2-', '3-', '4-', '5', '6', '7', '8', '9', '10', '11', '12');
    $replace = array('Jan ', 'Feb ', 'Mar ', 'Apr ', 'Mei ', 'Jun ', 'Jul ', 'Aug ', 'Sept ', 'Oct ', 'Nov ', 'Des ');
    $new_dirname = str_replace($search, $replace, $dirname);
    $url = sprintf('slipgaji/%s', base64_encode('%sfdjasgkfgdlAJGVLjlvkjlBSBHJ%s'), $file);
    echo "<ul id='gaji'><a href='$url' target='_blank' title='gaji'><img src='modules/mod_slipgaji/tmpl/pdf.png' />$new_dirname</a></ul>";
}

but this code can't showing my PDF file request by click URL. on my address bar shown http://localhost:8081/intranet/slipgaji/JXNmZGphc2drZmdkbEFKR1ZMamx2a2psQlNCSEolcw== please help me for this...

thanks

The problem is

$url = sprintf('slipgaji/%s', base64_encode('%sfdjasgkfgdlAJGVLjlvkjlBSBHJ%s'), $file);

The prototype for sprintf is

string sprintf ( string $format [, mixed $args [, mixed $... ]] )

You only provide one place to input to with your format slipgaji/%s, so it takes the base64_encoded string and ignores $file completely. JXNmZGphc2drZmdkbEFKR1ZMamx2a2psQlNCSEolcw== is the base64_encoded string you see in your address bar. You'll want to get rid of that base64_encode() and replace it with your path to the file. It should end up something like this:

// First %s gets replaced with $new_dirname, second %s is replaced with $file
$url = sprintf('slipgaji/%s/%s', $new_dirname, $file);

In the example above, $new_dirname should be '2013/1-2013' and $file should be '2013.05.1557.pdf' to get the URL you're expecting.