Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php从php URL中删除正斜杠_Php_Magento - Fatal编程技术网

php从php URL中删除正斜杠

php从php URL中删除正斜杠,php,magento,Php,Magento,我已经尝试了所有我能找到的方法来删除正在添加到此中的斜杠: $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'c2c_used_by_game'); if ($attribute->usesSource()) { $options = $attribute->getSource()->getAllOptions(false); echo ('<form me

我已经尝试了所有我能找到的方法来删除正在添加到此中的斜杠:

$attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'c2c_used_by_game');
if ($attribute->usesSource()) {
$options = $attribute->getSource()->getAllOptions(false);
echo ('<form method="post">');
echo ('<select onChange="window.location.href=this.value">');
foreach ($options as $option)

    {
        echo '<option value="'.Mage::getUrl('catalogsearch/advanced/result',array ('?c2c_used_by_game='=>$option['value'])).'">'.$option['label'].'</option>';
    }   
echo ('</select>');
echo ('</form>');
}
$attribute=Mage::getSingleton('eav/config')->getAttribute('catalog_product','c2c_used_by_game');
如果($attribute->usesSource()){
$options=$attribute->getSource()->getAllOptions(false);
回声(“”);
回声(“”);
foreach($options作为$option)
{
回显'.$option['label'].';
}   
回声(“”);
回声(“”);
}
这就是输出一个选择下拉列表,创建一个链接,比如on

我需要在等号后面去掉一条臭斜线,这样它的
c2c\u就被\u game=561使用了,我就是想不出来

array(“?c2c被游戏使用=”=>(str替换(“/”,“$option['value']))。
array ('?c2c_used_by_game='=>(str_replace('/','',$option['value'])))).

'">'.str_replace('/','',$option['label']).'</option>';
“>”.str_replace(“/”,“$option['label'])”;
在第二个参数中使用
\u query
正确构造查询:

Mage::getUrl('catalogsearch/advanced/result', array('_query' => array ('c2c_used_by_game' => $option['value'])));

更多关于函数用法的信息可以在Magento上找到。

这是一个肮脏的黑客行为,但是你可以通过游戏使用的c2c来分解结果,然后从
$split[1]=str_replace('/',''.$split[1]中去掉斜杠)
然后重新编译。Mihai,这没用。我不确定我是否完全理解你说的WASaquatch。我是PHP的爱好者。@BridgeRoad你能提供更多细节,在arrayarray(1)上做一个var_转储吗{[“?c2c_被_game=“]=>string(3)“936”}非常感谢你!谢谢你的维基。我正在寻找一个基于PHP的解决方案,甚至没有想到去Magento。