最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【未解决】php中能否检测代码字符串的编程语言的种类

PHP crifan 954浏览 0评论
折腾:
【未解决】WordPress的WP SyntaxHighlighter高亮代码时自动检测编程语言
期间,希望php中能实现,检测这段代码(的文本),能判断出是什么类型的编程语言
比如:
    $(".single_storybook_item").click(function(event) {
        console.log("event=", event)
        console.log("single_storybook_item: thisValue=", $(this))
        // window.location = $(this).data("href")
    })


                var eachBookHtml = `
                <li class="list-group-item single_storybook_item">
判断出是JavaScript
以便于设置到:
<pre class="brush: javascript; gutter: true">
中的javascript
这样插件即可显示对的高亮效果了
php detect string programming language type
Detect language from string in PHP – Stack Overflow
patrickschur/language-detection: A language detection library for PHP. Detects the language from a given text string.
都只是哪个国家的语言
Language Detection API
php detect string programming language
php hightlight detect programming language
scrivo/highlight.php: A port of highlight.js by Ivan Sagalaev to PHP
Programming language detection | NlpTools PHP
chrislo/sourceclassifier: Use a Bayesian classifier to determine source code language
angeloskath/php-sourceclassifier: Classify source code using a Naive Bayes text classifier
去试试能否用上
但是看了半天没找到
include (“vendor/autoload.php”);
中的
autoload.php
算了,放弃。即使可以用上,好像也很麻烦的样子。

转载请注明:在路上 » 【未解决】php中能否检测代码字符串的编程语言的种类

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.207 seconds, using 22.10MB memory