0

Jquery函数(它正在工作):

del_selected.on('click', function(e){

    box.filter(':checked').each(function(){
        selektovane_slike.push($(this).val());
        $(this).parent().slideUp('fast');
    });
    data = JSON.stringify(box.serialize(), null, 2);
    console.log(data);
    $.post(del_url, data, function(){

    }, JSON);
    e.preventDefault();
});

这个函数给出了这个结果:

"slike=apples.jpg&slike=50BestBandLogos.jpg&slike=Great-Logos-200x200.jpg"

在 PHP 中,我们有这个:

function ypg_delete_img_selected()
{
    print_r($_POST);
}

我得到的回应是:

不允许的关键字符。

问题是什么?

HTML:

<div class="zuta_strana_trenutne_slike">
                            <p>All Images</p>
                            <?php $imgs = explode(',', $zts['image']);
                                foreach($imgs as $img) : ?>
                            <div class="zuta_strana_izmena_slika">
                                <img src="<?php echo IMG ?>zute_strane/thumbs/<?php echo $img ?>" title="<?php echo $zts['name'] ?>" />
                                <input type="checkbox" name="slike" value="<?php echo $img  ?>" />
                                <a href="<?php echo base_url() ?>zute_strane/ypg_delete_img/<?php echo $img . '/' . $zts['id_global_info'] ?>" title="<?php echo $img ?>">Obriši Sliku</a>
                            </div>
                            <?php endforeach; ?>
                            <a class="zute_strane_izmena_selektuj_sve">Select All</a>
                            <a href="<?php echo base_url() ?>zute_strane/ypg_delete_img_selected/<?php echo $zts['id_global_info'] ?>" class="zute_strane_izmena_obrisi_sve">Delete Selected</a>
                        </div>
4

2 回答 2

1

您需要在 application/config/config.php 中更新您允许的字符:

$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\+-,?&=';

显然修改它以满足您的需求。

于 2012-10-12T18:40:34.787 回答
0

Relate an id to each image on the server and deal with ids instead of arbitrary file names. The way you are currently doing this is going to lead to a lot of headaches.

于 2012-10-12T19:43:18.973 回答