当前位置:网站首页>The repetition detection function of PHP multi line text content and count the number of repetitions
The repetition detection function of PHP multi line text content and count the number of repetitions
2022-07-24 05:38:00 【amogogo12】
When you encounter a pile of duplicate data, you need to detect the number of repetitions and sort , use php Make it simple form Form submission next . add layui The front end of the . The renderings are as follows :
The complete code is as follows :
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta name="robots" content="all" />
<title> Repeat the detection system </title>
<link rel="stylesheet" href="/layui/css/layui.css" media="all">
<style>
body{
width:70%;margin:10px auto;}
.layui-table-view .layui-table{
width:100%;}
</style>
</head>
<body class="html">
<blockquote class="layui-elem-quote layui-text">
( Data ranking )
</blockquote>
<form class="layui-form" action="" method="POST">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label"> Test content </label>
<div class="layui-input-block">
<textarea name="boddy" placeholder=" Please enter the content " class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1"> Submit... Immediately </button>
<button type="reset" class="layui-btn layui-btn-primary"> Reset </button>
</div>
</div>
</form>
<?php
error_reporting(0);
$post_data= $_POST['boddy'];
$list_array=explode("\n",$post_data);// Split carriage return and turn it into an array
$list_array= array_filter($list_array);
//print_r($list_array);
$num = count($list_array);
?>
<blockquote class="layui-elem-quote layui-text">
1. The data submitted this time are <?php echo $num;?> strip .<br />
2. Click after data submission “ Repeat the number ” Sort , You can directly copy the results to excel
</blockquote>
<table lay-filter="demo">
<thead>
<tr>
<th lay-data="{field:'data', width:500}"> Sorting data </th>
<th lay-data="{field:'datass', width:500, sort:true}"> Repeat the number </th>
</tr>
</thead>
<tbody>
<?php
//print_r(array_count_values ($list_array));
$ak = array_count_values($list_array);
/* $ak=array_count_values($list_array); // Count the number of times array elements appear $ak=array_flip($ak); // Key name and value are exchanged krsort($ak); // Arrange in descending order according to the index value of the array foreach ($ak as $key=>$value) { echo $key." ".$value."<br>"; } */
//echo "<pre>";print_r($aa);echo "<pre>";
foreach ($ak as $key => $value) {
echo "<tr><td>{$key}</td><td>{$value}</td></tr>";
}
?>
</tbody>
</table>
<blockquote class="layui-elem-quote layui-text">
amo'S copyright © <?php echo date('Y');?>
</blockquote>
<script src="/layui/layui.js" charset="utf-8"></script></body>
<script>
layui.use('table', function(){
var table = layui.table;
var $ = layui.$, active = {
parseTable: function(){
table.init('demo', {
// Convert static tables
//height: 'full-500'
limit: 1000,
});
}
};
window.onload =function() {
//alert(this);
var type = 'parseTable';
active[type] ? active[type].call(this) : '';
};
});
</script>
</html>
If there is any mistake, please forgive me !
边栏推荐
- Insanity:1(Insanity-Hosting)靶机渗透 —Vulnhub
- Substrate 技术及生态6月大事记 | Polkadot Decoded 圆满落幕,黑客松获胜项目为生态注入新生力量
- 波卡创始人 Gavin Wood:波卡治理 v2 会有哪些变化?
- 稀缺性之于Web3:如何成为去中心化世界的胜利者
- Draw a moving teapot on the screen. The teapot first moves slowly towards the screen, becoming smaller and smaller, becoming more and more blurred; Then it grows bigger and clearer, and keeps repeatin
- Web3基金会「Grant计划」赋能开发者,盘点四大成功项目
- Review the whole process of the 5th Polkadot Hackathon entrepreneurship competition, and uncover the secrets of the winning projects!
- 6. Draw a Bezier curve and a Bezier surface on the screen
- es10小计flat和flatMap
- Constructor_ Map constructor
猜你喜欢

首届波卡黑客松项目「Manta Network」的进击之路

sunset: noontide靶机渗透-vulnhub

登录 页面 + 总结心得

Latex learning notes (I) - installation configuration
![JS:为什么 [] == ![] 返回 true ?](/img/36/94839bf4ce6bd06d2cbe989828c791.png)
JS:为什么 [] == ![] 返回 true ?

haclabs: no_name(HL.ova)靶机渗透-Vulnhub

网页内嵌B站视频,隐藏相关控件

grid布局

Station B video comment crawling - take the blade of ghost destruction as an example (and store it in CSV)

关于DAO流动性双币质押挖矿开发原理分析
随机推荐
Mapboxgl + GeoServer configuration local map tutorial
Gavin wood, founder of Poka: what will happen to Poka governance V2?
Hex to RGB
根据数组中对象的某个属性值进行排序
Tabs tab (EL tabs)_ Cause the page to jam
mysql查询手机号码后四位,前几位怎么写?
6. Draw a Bezier curve and a Bezier surface on the screen
OpenGL simulates the process of a ball falling to the ground and bouncing up in real life. Draw a ball on the screen, and the ball will fall from top to bottom, hit the ground and bounce up again.
select_ Render small phenomena
How to forcibly uninstall Google browser? Don't worry about Google opening as a whiteboard. It's effective for personal testing.
The bottom of decentralization is consensus -- Interpretation of Polkadot mixed consensus mechanism
PoS机制随机性解读,波卡的随机性原理如何运作?
Web3基金会「Grant计划」赋能开发者,盘点四大成功项目
JS:为什么 [] == ![] 返回 true ?
pycharm 配置局域网访问,局域网无法访问解决办法
canvas - 旋转
过渡 效果
Define attribute of UMI
盘点波卡生态潜力项目 | 跨链特性促进多赛道繁荣
New grammar 01_ ES6 new syntax