Here's my url

这是我的网址

localhost/project/#/showprofile/18

I want to display the parameter 18 in my view

我想在视图中显示参数18

In the app.js i have

在app.js我有

.when('/showprofile/:UserID', {
     title: 'Show User Profile',
     templateUrl: 'views/layout/showprofile.php',
     controller: 'authCtrl',
     })

Here the page showprofile.php is displaying, but suddenly the url goes like this

在这里显示showprofile.php页面,但突然网址就像这样

localhost/project/#/showprofile/:UserId

How can i get the value 18 inside the showprofile.php and make the url as it is i.e.,

如何在showprofile.php中获取值18并使其成为原样,即,

localhost/project/#/showprofile/18

3 个解决方案

#1


2

Use $routeParams to get the parameter value:

使用$ routeParams获取参数值:

$routeParams.UserID

Make sure you inject $routeParams before using it.

确保在使用之前注入$ routeParams。

EDIT How can i get the value 18 inside the showprofile.php

编辑如何在showprofile.php中获取值18

<?php
    $link = $_SERVER['PHP_SELF']; // Get current URL
    $link_array = explode('/', $link); // Split by /
    echo $page = end($link_array); // Get last element from array

?>

更多相关文章

  1. 使用包含特定号码的网址重定向到索引
  2. 如何使用Javascript ajax发送网址? [重复]
  3. 如何添加动态参数
  4. 根据网址上的国家/地区将用户重定向到正确的数据库,我使用i18n fo
  5. 在php中获取引荐来源网址(包括参数)
  6. php通过$_SERVER[&#39;HTTP_USER_AGENT&#39;]获取浏览器相关参数
  7. PHP Word上的短网址
  8. MYSQL5.5和5.6参数的差异
  9. 存储过程,参数数量不正确bug?

随机推荐

  1. Qt on Android:让 Qt Widgets 和 Qt Quick
  2. Android(安卓)layout 优化:使用include和m
  3. Android 各大网络请求库的比较及实战,andr
  4. 2014 年 Android 碎片化报告
  5. Android开发之webview和 js 互调
  6. 最新Android开发视频教程(共6章)Android St
  7. 微软手握的 Android(安卓)专利一年可捞 4
  8. android 的现状和未来涉及的领域 以及开
  9. Android平台中进程与线程的基本知识
  10. Android面试经验一: