1.php点击按钮执行ssh命令登陆路由器并执行命令
2.thinkphp 3.1 路由怎么设置?
3.ãPHPãlaravelä¸è·åå½åè·¯ç±å称
php点击按钮执行ssh命令登陆路由器并执行命令
代码如下:
<?由源创世红海源码下载php
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, '');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
echo $file_contents;
>thinkphp 3.1 路由怎么设置?
//比如配置为default.html路由配置
'URL_ROUTER_ON'=>true,
'URL_ROUTE_RULES'=>array(
'default'=>'Home/Index/index',
),
模板中:<{ :U('/default')}>
ãPHPãlaravelä¸è·åå½åè·¯ç±å称
ç»è®ºï¼Routeç±»æ¯å¿ é¡»å¼å ¥çãæ以å¯ä»¥è°ç¨éææ¹æ³ currentRouteName()ã1 - 为ä»ä¹ä¸å¼å ¥Routeç±»ä¹å¯ä»¥è¿è¡ï¼ å 为Routeç±»æ¯å¨ç³»ç»å¯å¨æ¶ä½ä¸ºå ¨å±ç±»è¿è¡äºæ³¨åãå¨æ件 config/app.php æ件å å¦ä¸æ示ï¼
Routeé¨é¢æ¤å¤æ³¨åå°å ¨å±ï¼ä¹å°±æ¯æ ¹å½å空é´ãæ以å¨ç¨åºå ï¼ç´æ¥ä½¿ç¨ Route::method() ä¸ä¼æä»»ä½é®é¢ã
æ们å¨ç¼ç¨ä¸ï¼å¯¹äºå ¨å±æ³¨åçç±»ï¼ä¹éè¦éè¿æ¤æ¹æ³ï¼æ·»å 注åã
2 - è·åå½åè·¯ç±å称çä¸äºæ¹æ³ä¸¾ä¾ 使ç¨Routeç±»çæ¹æ³ï¼Route::getCurrentRoute()->getPath();
æè 使ç¨Requestç±»çæ¹æ³ï¼
\Request::route()->getName()ï¼
laravel 5.1 ä½ å¾è¿ä¹åï¼
use Illuminate\Support\Facades\Route;
$currentPath= Route::getFacadeRoot()->current()->uri();
å°äº5.2çæ¬ï¼å°±æ¯é¢ä¸»çåæ³ï¼
Route::currentRouteName();
5.3çæ¬å°5.8çæ¬ï¼æ´å çµæ´»äºï¼
$uri = $request->path();
ä½¿ç¨ Request 对象çæ¹æ³å°±å¯ä»¥è¿åãè·åè·¯ç±ï¼è·¯ç±å称ï¼æ¹æ³åï¼
$route = Route::current();
$name = Route::currentRouteName();
$action = Route::currentRouteAction();
å°äºlaravel 7.x 对请æ±å¯¹è±¡ Request æäºæ´å 丰å¯çç¹æ§ï¼
$request->route()->getName();
ç»è¯ 以ä¸è·åè·¯ç±åçæ¹æ³ï¼æ ¹æ®ä¸ålaravelçæ¬ï¼è¿è¡ä¸åçå¤çãç»èä¸çä¸åä¸å®è¦å¤å 注æã