PHP后端代码:<?php if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) { $target_dir = "uploads/"; if (!is_dir($target_dir)) { mkdir($target_dir, 0777, true); } $current_time = date("Ymd_His"); $file_extension = pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION); $new_file_name = $current_time . "." . $file_extension; $target_file = $target_dir . $new_file_name; if (file_exist
如果对数据写入要求不高,需要轻量级的数据管理的话,推荐LiteDb数据库。安装之后只有一个DLL文件来做调用。相关代码片段:Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ' 获取应用程序的目录 Dim appDirectory As String = AppDomain.CurrentDomain.BaseDirectory ' 数据库文件路径 Dim dbPath As String = Path.Combine(appDirectory, "example.db") ' 打开或创建数据库文件 Using db As New LiteDatabase(dbPath) ' 获取Users集合 Dim users = db.GetCollection(Of User)("Users")
最近一直在找可快速读取与写入的Excel库,发现MiniExcel库非常不错。速度也挺快。读取:Dim currentDirectory As String = AppDomain.CurrentDomain.BaseDirectory Dim filePath As String = IO.Path.Combine(currentDirectory, "222.xlsx") Dim rows As IEnumerable(Of Object) = MiniExcel.Query(filePath) For Each row As IDictionary(Of String, Object) In rows If row.ContainsKey("B") Then Console.WriteLine($"B: {row("B")}") End If Next Console.WriteLine("读取完成") 写入(不带标头): Dim curren
Imports System.IO Imports Newtonsoft.Json Module ini读写模块 Public Sub SaveConfig(config As Config, filePath As String) Dim json As String = JsonConvert.SerializeObject(config, Formatting.Indented) File.WriteAllText(filePath, json) End Sub Public Function LoadConfig(filePath As String) As Config If Not File.Exists(filePath) Then Return New Config() End If Dim json As String = File.ReadAllText(filePath) Return JsonConvert.Des
留存下模块代码,下次写代码就不用翻之前的代码了。模块代码: Module ini读写模块 Private Declare Unicode Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntW" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Integer, ByVal lpFileName As String) As Integer Private Declare Unicode Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringW" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As Strin
Me.DataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter For i As Integer = 0 To DataGridView1.Columns.Count - 1 Me.DataGridView1.Columns(i).SortMode = DataGridViewColumnSortMode.NotSortable Next
类文件[IPHelper.vb]: Imports System Imports System.Collections.Generic Imports System.IO Imports System.Linq Imports System.Net Imports System.Text Imports System.Threading.Tasks Namespace IPLibrary ''' <summary> ''' IP归属地查询 ''' qqwry.dat文件的结构原理参考:[qqwry.dat的数据结构图文解释](https://www.jb51.net/article/17197_all.htm) ''' </summary> Public Class IPHelper ' IP库文件地址 Private ReadOnly mLibraryFilePath As String ' 第一条索引的绝对地址 Private ReadOnly m
首先在Nuget中搜索JSON。然后下载Newtonsoft.Json.Linq然后使用下面的代码进行解析: ' 解析JSON数据 Dim jsonObject As JObject = JObject.Parse(responseContent) Dim code As String = jsonObject("code").ToString() If code = "1000" Then 全局变量_ip = jsonObject.SelectToken("data[0].ip").ToString() 全局变量_port = jsonObject.SelectToken("data[0].port").ToString() End If
取自程序的一段代码,放到博客,省得下次再找了。Dim rowIndex As Integer = DataGridView1.Rows.Add() With DataGridView1.Rows(rowIndex) .Cells(0).Value = rowIndex + 1 .Cells(1).Value = nickname .Cells(2).Value = unique_id .Cells(3).Value = following_count .Cells(6).Value = 待监控的粉丝数量 .Cells(8).Value = "基础数据已获取" .Cells(9).Value = id_str 'sec_uid End With DataGridView1.Refresh()
转换方式如下图:直接GET请求下抖音分享链接即可。注意:需要禁止重定向。在返回的内容处,可以获取用户的sec_uid(MS开头)VB.NET 实现代码:Imports System.Net Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim request As HttpWebRequest = DirectCast(WebRequest.Create(TextBox1.Text), HttpWebRequest) request.AllowAutoRedirect = False Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse) Dim responseStrea
LaoDan
鱼头网络工作室