Maison  >  Questions et réponses  >  le corps du texte

nginx pseudo-statique

Comment écrire s'il y a plus de 10 paramètres pseudo-statiques
réécrire /index/([a-z]+)-(d+)-(.)-(.)-(d+)-(.)-( .)- (d+)-1-1-(d+)-(d+)-(d+).html$ /index.php?type=$1&cid=$2&q=$3&commission=$4&volume=$5&price_start=$6&price_end =$7&sort= $8&tmall=1&only=1&jr_update=$9&jr_insert=$10&page=$11 last;
Les 10$ suivants seront analysés en 1 0$
J'ai essayé ${10} mais ça n'a pas marché non plus

Posez et répondez à vos propres questions, je les publierai plus tard !

Je jurais à la fin !
Baidu, qui vend de faux médicaments, fermez vite ses portes ! A quoi ça te sert ! La recherche ne recommandera que de faux médicaments ! ! !
http://kzone.iteye.com/blog/1932104

réécrire /index/([a-z]+)-(d+)-(.)-(.)-(d+)-(.)-(.)-(d+)-1-1-(d+ )-(?<n0>d+)-(?<n1>d+).html$ /index.php?type=$1&cid=$2&q=$3&commission=$4&volume=$5&price_start=$6&price_end=$7&sort= $8&tmall=1&only=1&jr_update=$9&jr_insert=$n0&page=$n1 last;
réécrire /index/([a-z]+)-(d+)-(.)-(.)-(d+)-(. )-(.)-(d+)-0-0-(d+)-(?<n0>d+)-(?<n1>d+).html$ /index.php?type=$1&cid=$2 &q=$3&commission=$4&volume=$5&price_start=$6&price_end=$7&sort=$8&tmall=0&only=0&jr_update=$9&jr_insert=$n0&page=$n1 last;
réécrire /index/([a-z]+)-(d+)- (.)-(.)-(d+)-(.)-(.)-(d+)-1-0-(d+)-(?<n0>d+)-(?<n1> ;d+).html$ /index.php?type=$1&cid=$2&q=$3&commission=$4&volume=$5&price_start=$6&price_end=$7&sort=$8&tmall=1&only=0&jr_update=$9&jr_insert=$n0&page=$n1 dernier ;
réécrire /index/([a-z]+)-(d+)-(.)-(.)-(d+)-(.)-(.)-(d+)-0-1-( d+)-(?<n0>d+)-(?<n1>d+).html$ /index.php?type=$1&cid=$2&q=$3&commission=$4&volume=$5&price_start=$6&price_end=$7&sort =$8&tmall=0&only=1&jr_update=$9&jr_insert=$n0&page=$n1 dernier;

réécrire /index/([a-z]+)-(d+)-(.)-(.)-(d+)-(.)-(.)-(d+)-(d+)-1- (?<n0>d+)-(?<n1>d+).html$ /index.php?type=$1&cid=$2&q=$3&commission=$4&volume=$5&price_start=$6&price_end=$7&sort=$8&tmall =$9&only=1&jr_update=$n0&page=$n1 last;
réécrire /index/([a-z]+)-(d+)-(.)-(.)-(d+)-(.)-(. )-(d+)-(d+)-0-(?<n0>d+)-(?<n1>d+).html$ /index.php?type=$1&cid=$2&q=$3&commission=$4 &volume=$5&price_start=$6&price_end=$7&sort=$8&tmall=$9&only=0&jr_update=$n0&page=$n1 last;

过去多啦不再A梦过去多啦不再A梦2712 Il y a quelques jours708

répondre à tous(2)je répondrai

  • PHPz

    PHPz2017-05-16 17:19:31

    Posté, la réponse est dans ma question

    répondre
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 17:19:31

    Personnellement, je trouve que c'est un peu trop inesthétique. Vous pouvez envisager d'écrire un itinéraire interne ou une règle de saut, par exemple :
    Écrit de manière pseudo-statique :

    rewrite ^/(.*?) /index.php?location= last;

    Ajouter des règles à la page php :

    $location = $_GET['location'];
    $tag = '-';
    $paramter_key = array('type', 'cid', 'q', 'commission', 'volume', 'price_start', 'price_end', 'sort', 'tmall', 'only', 'js_update', 'jr_insert', 'page');
    $paramter_value = explode($tag, $location);
    
    //url参数及对应值形成的数组
    $paramter = array_combine($paramter_key, $paramter_value);
    //也可以把数组形式打散为变量形式
    extract($paramter);
    
    /**
     * 使用变量
     * echo $paramter['type'];
     * or
     * echo $type;
     */

    répondre
    0
  • Annulerrépondre