本文實例講述了PHP基于ffmpeg實現(xiàn)轉(zhuǎn)換視頻,截圖及生成縮略圖的方法。分享給大家供大家參考,具體如下:這里把ffmpeg和生成縮略圖整合了一下:iclude(&quo;ImageReize.cla.php&quo;)//轉(zhuǎn)視頻$cmd=&quo;ffmpeg.exe-iawa.av......
以下是【金聰采編】分享的內(nèi)容全文:
以下是【金聰采編】分享的內(nèi)容全文:
一、寫結(jié)果緩存文件
/** * 寫結(jié)果緩存文件 * * @params string $cache_name * @params string $caches * * @return */function write_static_cache($cache_name, $caches){ if ((DEBUG_MODE & 2) == 2) { return false; } $cache_file_path = ROOT_PATH . '/temp/static_caches/' . $cache_name . '.php'; $content = "<?php/r/n"; $content .= "/$data = " . var_export($caches, true) . ";/r/n"; $content .= "?>"; file_put_contents($cache_file_path, $content, LOCK_EX);}二、讀結(jié)果緩存文件
/** * 讀結(jié)果緩存文件 * * @params string $cache_name * * @return array $data */function read_static_cache($cache_name){ if ((DEBUG_MODE & 2) == 2) { return false; } static $result = array(); if (!empty($result[$cache_name])) { return $result[$cache_name]; } $cache_file_path = ROOT_PATH . '/temp/static_caches/' . $cache_name . '.php'; if (file_exists($cache_file_path)) { include_once($cache_file_path); $result[$cache_name] = $data; return $result[$cache_name]; } else { return false; }}以上就是php 寫入緩存文件、讀取緩存文件內(nèi)容的函數(shù)代碼,需要的朋友可以參考一下。

侵權(quán)舉報/版權(quán)申訴



