作成中
投稿者: Hisa
PHP WordをHTML出力 docx_reader
< コード例 >
docx_reader.phpを配置してincludeで読み込んで使います。
include('./docx_reader.php'); // == リクエストパラメータ == // $filename = $_POST["filename"] ? $_POST["filename"] : $_GET["filename"]; if (!$filename) { $filename = "/path/filename.docx"; } $doc = new Docx_reader(); $doc->setFile($filename); if(!$doc->get_errors()) { $html = $doc->to_html(); $plain_text = $doc->to_plain_text(); echo $html; } else { echo implode(', ',$doc->get_errors()); } echo "\n";
PHP ExcelをHTML出力 excel2html
GitHubのリンク
< インストール >
composer でインストールします。
[????@????]# composer require tomk79/php-excel2html Cannot load Zend OPcache - it was already loaded No composer.json in current directory, do you want to use the one at /home/ApacheDoc/invfiles? [Y,n]? n Do not run Composer as root/super user! See https://getcomposer.org/root for details Continue as root/super user [yes]? y Info from https://repo.packagist.org: #StandWithUkraine ./composer.json has been created Running composer update tomk79/php-excel2html Loading composer repositories with package information Updating dependencies Lock file operations: 14 installs, 0 updates, 0 removals - Locking ezyang/htmlpurifier (v4.16.0) - Locking maennchen/zipstream-php (2.1.0) - Locking markbaker/complex (3.0.2) - Locking markbaker/matrix (3.0.1) - Locking michelf/php-markdown (1.9.1) - Locking myclabs/php-enum (1.8.4) - Locking phpoffice/phpspreadsheet (1.25.2) - Locking psr/http-client (1.0.2) - Locking psr/http-factory (1.0.2) - Locking psr/http-message (1.1) - Locking psr/simple-cache (1.0.1) - Locking symfony/polyfill-mbstring (v1.27.0) - Locking tomk79/filesystem (1.2.3) - Locking tomk79/php-excel2html (0.1.2) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 14 installs, 0 updates, 0 removals - Installing ezyang/htmlpurifier (v4.16.0): Extracting archive - Installing symfony/polyfill-mbstring (v1.27.0): Extracting archive - Installing psr/http-message (1.1): Extracting archive - Installing myclabs/php-enum (1.8.4): Extracting archive - Installing maennchen/zipstream-php (2.1.0): Extracting archive - Installing markbaker/complex (3.0.2): Extracting archive - Installing markbaker/matrix (3.0.1): Extracting archive - Installing psr/http-client (1.0.2): Extracting archive - Installing psr/http-factory (1.0.2): Extracting archive - Installing psr/simple-cache (1.0.1): Extracting archive - Installing tomk79/filesystem (1.2.3): Extracting archive - Installing phpoffice/phpspreadsheet (1.25.2): Extracting archive - Installing michelf/php-markdown (1.9.1): Extracting archive - Installing tomk79/php-excel2html (0.1.2): Extracting archive 5 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating autoload files 3 packages you are using are looking for funding. Use the `composer fund` command to find out more! No security vulnerability advisories found
< コード例 >
<?php require_once( '../vendor/autoload.php' ); ini_set("memory_limit", "-1"); ini_set('max_execution_time', 180); // == リクエストパラメータ == // $filename = $_POST["filename"] ? $_POST["filename"] : $_GET["filename"]; if (!$filename) { $filename = "/path/filename.xlsx"; } $src = (new \tomk79\excel2html\main($filename))->get_html( array( 'renderer' => 'strict', 'cell_renderer' => 'html', 'render_cell_width' => true, 'render_cell_background' => true, 'render_cell_borders' => true, 'render_cell_align' => true, 'render_cell_vertical_align' => true, )); print $src;
< 画面例 >
Python 基本メモ Shell
< コード例 >
# smbstatus shell 実行 # args = ["smbstatus", "-L"] output= subprocess.check_output(args, shell=True, encoding='utf8')
杉下茂・戦争
戦争は人間の未来を奪う
上岡龍太郎・歩け
エスカレーターに乗っても歩きなさい。自分を機械に任せたら終わりです。
中西太・感謝
僕はいつも人が評価してくれることに感謝してる。
職に就けてくれたことに感謝してる。
だから死に物狂いでやらなきゃいかん。
西原春夫・地震自己責任
『 地震そのものは、人の力では阻止できない。従って、地震に不可避に伴う結果については、だれを非難することもできないだろう。冷たい言葉で言えば、自己責任に帰せられる災害、運命とあきらめなければならない部分が人生にあることは認めざるを得ない。 』
Python 基本メモ メール送信
< コード例 >
## 完了メール配信 ## TO_ADDRS = ["????????@gmail.com", "???????@?????.co.jp"] smtp_server = "???????" port = ?? server = smtplib.SMTP(smtp_server, port) server.set_debuglevel(True) message = MIMEMultipart() message["Subject"] = "@@ タイトル @@" message["To"] = ",".join(TO_ADDRS ) message["From"] = "??????" text = MIMEText("本文") message.attach(text) server.send_message(message) server.quit()
コメントを投稿するにはログインしてください。