Home Backend Development PHP Tutorial php+mysql 取视频表信息。怎么匹配截取name

php+mysql 取视频表信息。怎么匹配截取name

Jun 13, 2016 pm 01:18 PM
name split video

php+mysql 取视频表信息。如何匹配截取name
php+mysql 数据库视频表 取视频信息 video_list
其中有字段video_name 如下: 
数据1《百家讲坛》20111220 
数据2《百家讲坛》20111214 王立群读《史记》――秦始皇(三十)生死茫茫 
如果是数据1 直接取video_name,输出
如果是数据2 截取时间后面的字符输出
8位日期数字的左右都有一个空格符。
请问我该如何在循环中判断这2中类型并截取呢?是用正则么,该怎嘛写啊

------解决方案--------------------
$t = preg_split('/\s+\d+\s+/', $roe['video_name'], PREG_SPLIT_NO_EMPTY);
echo end($t);

------解决方案--------------------
哦,少了一个参数
$t = preg_split('/\s+\d+\s+/', $roe['video_name'],-1, PREG_SPLIT_NO_EMPTY);
------解决方案--------------------
$roe['video_name']= '《百家讲坛》20111214 王立群读《史记》――秦始皇(三十)生死茫茫';
$chars = preg_split('/[0-9]/', $roe['video_name'], -1,PREG_SPLIT_NO_EMPTY );
$rs= (count($chars)>1) ? $chars[1] : $roe['video_name'];
echo $rs;

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to fix VIDEO DXGKRNL fatal error in Windows 11 How to fix VIDEO DXGKRNL fatal error in Windows 11 Apr 13, 2023 pm 08:22 PM

Click to enter: ChatGPT Tool Plug-in Navigation Collection Some users complained that their computers frequently crashed with the stop code VIDEO DXGKRNL FATAL ERROR. This particular issue occurs only occasionally and has a bugcheck value of 0x00000113, which indicates a violation in the Microsoft DirectX graphics kernel subsystem, as indicated by the bugcheck value. Usually, the error occurs when a corrupt driver interferes with the normal operation of the graphics card's graphics processor. If you're currently struggling with this specific issue, our article will provide you with a variety of high-quality troubleshooting tips. Below you'll find various methods that other users who encountered the exact same error have used successfully. yes

Motorola Razr 50 Ultra shows up in leaked teaser video with waterproof case and huge secondary display Motorola Razr 50 Ultra shows up in leaked teaser video with waterproof case and huge secondary display Jun 20, 2024 pm 09:31 PM

Over the past few weeks, the most important specifications and the euro prices of the Motorola Razr 50 and the Razr 50 Ultra have been leaked. Now the enormously reliable leaker @MysteryLupin was able to publish the teaser video embedded below, which

Snapdragon X Elite CPU performance nearly identical on battery and plugged-in in Vivobook S15 benchmarks Snapdragon X Elite CPU performance nearly identical on battery and plugged-in in Vivobook S15 benchmarks Jun 20, 2024 pm 03:59 PM

Despite the hype surrounding the Qualcomm Snapdragon X Elite, it has been a rather mediocre launch. In our review, we found that the most impressive part of the new Qualcomm Snapdragon X Elite X1E-78-100-powered Asus Vivobook S 15 was the seamlessnes

How to use the split method in Java String How to use the split method in Java String May 02, 2023 am 09:37 AM

The split method in String uses the split() method of String to split the String according to the incoming characters or strings and return the split array. 1. General usage When using general characters, such as @ or, as separators: Stringaddress="Shanghai@Shanghai City@Minhang District@Wuzhong Road";String[]splitAddr=address.split("@");System .out.println(splitAddr[0]+splitAddr[1]+splitAddr[2]+splitAddr[3

Snapdragon X Elite CPU performance nearly identical on battery vs AC power in Vivobook S15 benchmarks Snapdragon X Elite CPU performance nearly identical on battery vs AC power in Vivobook S15 benchmarks Jun 21, 2024 am 06:50 AM

Despite the hype surrounding the Qualcomm Snapdragon X Elite, it has been a rather mediocre launch. In our review, we found that the most impressive part of the new Qualcomm Snapdragon X Elite X1E-78-100-powered Asus Vivobook S 15 was the seamlessnes

How to solve 'undefined: bytes.Split' error in golang? How to solve 'undefined: bytes.Split' error in golang? Jun 25, 2023 pm 02:02 PM

In the Go language, the bytes package is a package for manipulating byte types, and it contains many useful methods, such as the Split() method. However, when using the Split() method, you may encounter an "undefined: bytes.Split" error. This error is usually caused by incompatible Go versions or lack of necessary dependent libraries. This article will introduce some methods to solve this error. Method 1: Upgrade the Go version as follows

How to use split in python How to use split in python Nov 17, 2023 am 10:13 AM

In Python, split() is a commonly used string method that splits a string into substrings and returns a list containing these substrings. This method can split a string into multiple parts based on the specified delimiter. The basic syntax is "str.split(separator, maxsplit)", str is the string to be split, separator is the separator, and maxsplit is an optional parameter, indicating the maximum number of splits.

What should I do if the video tag of html5 cannot be played? What should I do if the video tag of html5 cannot be played? Jan 28, 2023 am 09:36 AM

Solution to the problem that the HTML5 video tag cannot be played: 1. Use a video screenshot to make a play button and occupy the original position of the video; 2. Monitor the click event of the occupying button and use "video.play()"; 3. Just hide the bitmap and loading.

See all articles