当前位置:网站首页>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 !
边栏推荐
- Inventory Poka ecological potential project | cross chain characteristics to promote the prosperity of multi track
- Latex learning notes (I) - installation configuration
- There are three ways to create in Polkadot - parallel chain, parallel thread, and smart contract
- 登录 页面 + 总结心得
- 新建 umi 项目,Error: Rendered more hooks 或者 Rendered fewer hooks
- MySQL之CRUD
- Moonbeam Orbiters Program:为收集人参与 Moonbeam 和 Moonriver 提供新方式
- XML之建模
- String_ Method_ 01match method
- Vulnhub-Funbox: Rookie(Funbox2)靶机渗透
猜你喜欢
随机推荐
MySQL的使用
The profound meaning of unlimited ecological development in Poka -- Multidimensional Interpretation of parallel chain
jsp标签
树状结构+节点
Summary of data types
Inventory Poka ecological potential project | cross chain characteristics to promote the prosperity of multi track
【百度地图API】您所使用的地图JS API版本过低,已不再维护,为保证地图基本功能 正常使用,请尽快升级到最新版地图JS API
动画 效果
Web3 Foundation grant program empowers developers to review four successful projects
PoS机制随机性解读,波卡的随机性原理如何运作?
canvas - 旋转
canvas - Bezier 贝塞尔曲线
MySQL的分页你还在使劲的limit?
关于DAO流动性双币质押挖矿开发原理分析
Tree structure + node
CESS 测试网上线!首个提供多元应用场景的去中心化存储网络
在 Polkadot 中进行创建的三种方式 —— 平行链、平行线程、智能合约
Cess test online line! The first decentralized storage network to provide multiple application scenarios
Function Closure
整站下载器推荐



![利用流媒体将RSTP流转成WEB端播放(二)[可回看]](/img/b9/2c0e6eb19acaa2356ff49f6e272826.png)




