search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

3 answers
Q&A separator problem
separator problem
太子 2018-10-09 10:40:03 Views 1690
PHP

0

Hello teacher, the address demonstrated in your videowww.tp5.com/hello/aaa/dddd-33-ccc-444-eee-5555.html is displayed like this, but after modifying the configuration file separator The displayed address is not the address of your color but www.tp5.com/hello-aaa-dddd-33-ccc-444-eee-5555.html. When clicking, it prompts that the hello module is not found.

What is the reason?

Your Answer
submit

3 answers
0

Routing rules or pseudo-static rules are not configured.

2018-10-09 11:34:22

'pathinfo_depr' => '-', setting this will display www.tp5.com/hello-dddd-33-ccc-444-eee-5555.html. Such a connection routing rule also rewrites 'hello/[ :dddd]/[;ccc]/[:eee]' => ['index/index/hello', ['method' => 'get'], ['dddd' => '\d{4 }','ccc' => '\d{4}'.'eee' => '\d{4}']], Did I write the rules wrong?

太子 2018-10-09 11:41:28

Can you give me some guidance?

太子 2018-10-09 11:41:43

submit

0

Your question and answer involves combination variable rules in routing:

Route::get('item-<name>-<id>', 'product/detail')
    ->pattern(['name' => '\w+', 'id' => '\d+']);

The advantage of combined variables is that there are no fixed separators in routing rules, and you can combine the required variable rules and separators at will, for example Routing rules can be supported by changing them to the following:

Route::get('item<name><id>', 'product/detail')
    ->pattern(['name' => '[a-zA-Z]+', 'id' => '\d+']);Route::get('item@<name>-<id>', 'product/detail')
    ->pattern(['name' => '\w+', 'id' => '\d+']);

The above official website describes the variable rules. If you have many variables, in order to generate a URL address that is friendly to search engines, you can use combined variable rules to beautify you. URL address, but it will lose a certain execution efficiency. If your operation has no parameters or default parameters, you should pay attention to the changes in the rules to prevent failure~~

2018-10-11 10:01:24

submit

0

Moderator, have you found a solution? I also encountered this problem. I changed the separator and then output it in the URL address bar saying: Template not found. How to solve this problem?

2020-01-03 00:02:26

submit

Popular tool

vc9-vc14 (32+64 bit) runtime library collection (link below)

vc9-vc14 (32+64 bit) runtime library collection (link below)

Download the collection of runtime libraries required for phpStudy installation

VC9 32-bit

VC9 32-bit

VC9 32-bit phpstudy integrated installation environment runtime library

PHP programmer toolbox full version

PHP programmer toolbox full version

Programmer Toolbox v1.0 PHP Integrated Environment

VC11 32-bit

VC11 32-bit

VC11 32-bit phpstudy integrated installation environment runtime library

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use