PHP实现将textarea的值根据回车换行拆分至数组
本文实例讲述了PHP实现将textarea的值根据回车换行拆分至数组的方法。分享给大家供大家参考。具体分析如下:
textarea回车换行为 \r\n
1 2 |
$keyword_list = trim($_REQUEST['keywords']); $keyword_arr = explode("\r\n", $keyword_list); |
这个地方需要注意是要去除textarea 前后的空格,否则会多出一个
或者使用explode也是可以的
只是不能用\r\n只能用双引号,不能用单引号

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.