从帖子标题自动生成关键字

For example I have title "The Battleship Trailer" so it will generate keyword like this "best , player, of, the, world" how can i do it ?

I want to apear in html like this...

First:The
Second:Battleship
Third:Trailer

<meta name="keywords" content="<FirstWord>,<second>,<third>"/> 

More exactly i want to split the title in words.

I use Wordpress

It might be better to get the post's slug. That will sanitize and strip out any shorter words that won't be of any value to search engines. Then explode and implode with PHP...

Here how:

 // Get the global post variable (inside or outside the loop)
 global $post;

 // Seperate title slug by dashes into array
 $the_slug_into_array = explode('-', $post->post_name);

 // Convert array back into a string with comma separation
 $the_keywords = implode(',', $the_slug_into_array );

 // Echo out the string of terms from the title
 echo $the_keywords;

Let me know if this worked for you...

echo '<meta name="keywords" content="'.implode(',', explode(' ', $string)).'"/>';

This would join the words separated by a space in $string with a comma. Obviously replace $string the proper variable.

$string = get_the_title(); // Inside your header.php 
echo '<meta name="keywords" content="'.implode(',', explode(' ', $string)).'"/>';

Reference: http://codex.wordpress.org/Template_Tags/get_the_title

Reference: http://php.net/manual/en/function.implode.php