N
N
nuclear_kote2016-09-21 14:18:50
PHP
nuclear_kote, 2016-09-21 14:18:50

Why doesn't bundle work when building an angular2 project?

tsconfig.json:

{
  "compilerOptions": {
  	"outFile": "app/main.js",
    "target": "es6",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "gulpfile.ts",
    "node_modules"
  ]
}

if instead of outFile I use outDir everything works. The console is clean. I tried alerting the generated js in System.register("main".. -> execute stick - not called.
Just in case, the project source (angular2 tutorial from off site with modified assembly): https://yadi.sk/d/700BSa77vUsaP

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nemiro, 2016-09-04
@tvelforce

You can parse the URL using the parse_url function . You can get individual query string parameters using the parse_str method .

$url = 'http://blog.des/?go=category&q=backend&page=2';
// в элементе с именем query будет строка параметров запроса
// go=category&q=backend&page=2
$query = parse_url($url)['query'];
// функция parse_str разберет строку параметров запроса
// и передаст ассоциативный массив в переменную $params
parse_str($query, $params);
// выводим значение параметра page
echo $params['page'];

Or you can immediately pass URL to parse_str :
$url = 'http://blog.des/?go=category&q=backend&page=2';
parse_str($url, $params);
echo $params['page'];

If you want to get the value of a parameter for the current page, it's easier to do it via $_GET :
You can remove a parameter from a query string simply by collecting a new string, omitting the parameters you don't need. For the current address something like this:
$queryString = [];

foreach ($_GET as $key => $value) {
  // если параметр page, пропускаем его
  if ($key == 'page') { continue; }
  // остальные добавляем в queryString
  $queryString[$key] = $value;
}

// собираем массив новых параметров в строку параметров запроса
$queryString = http_build_query($queryString);

// новые параметры
echo $queryString;

Having received a new parameter string, you can generate a new URL and redirect to it:
$url = "http://blog.des/";

if ($queryString != '')
{
  $url .= "?".$queryString;
}

// это следует делать до первого вывода, иначе могут быть ошибки/предупреждения
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$url);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question