如何使用爆炸分裂

I need to split a text when users add a new line and put this new line (by HTML) into an array position.

<?php
$urlstoafiliate = $_POST['urls'];
$affcj = "http://www.an.com";

$arraylinks = explode("/
|
|/", $urlstoafiliate);
echo $arraylinks[ 0 ];

//echo $nombre;
?>

You have need preg_split() like this :

<?php
  $urlstoafiliate = $_POST['urls'];
  $arraylinks = preg_split("/
|
|/", $urlstoafiliate);
  print_r($arraylinks);
  // or 
  echo $arraylinks[0]; 
?>

More details : http://php.net/manual/en/function.preg-split.php

I would use explode(" ", $urlstoafiliate) to get an array of strings and then I would call trim() on each string to remove any trailing (if any) but also any leading or trailing spaces (the URLs input by the user may have leading and/or trailing spaces, especially when the user copy/paste them from other sources):

$arraylinks = array_map('trim', explode("
", $_POST['urls']));