私はコンポーザーのためのPackagistパッケージlwilson/onepageを1つのPHPファイルで持っています。ファイルには1つのクラスがあり、1つの関数が含まれています。私は自分のWebサーバーにパッケージをインストールしました。私はそれを使用するはずのPHPファイルを持っています。私は、サーバーにインストールされている他のコンポーザー・ライブラリを使用できるので、作者のオートローダーが正しく組み込まれていることを知っています。私の作曲家プロジェクトのクラスはロードされません
Fatal error: Class 'OnePage\OnePage' not found in /home/photox952/public_html/onepage/test_onepage.php on line 6
test_onpepage.php
(ファイルクラスを使用しています):
<?php
require '../../vendor/autoload.php';
use OnePage\OnePage;
file_put_contents("index.php",OnePage::OnePage(json_decode(file_get_contents("cfg.json")),__DIR__));
?>
compiler.php
(パッケージ内のファイル):
<?php
namespace OnePage;
// This is licenced under the GNU GENERAL PUBLIC LICENSE. More info at: https://github.com/LeoWilson-XnD/lwilson_onepage/blob/master/LICENSE
class OnePage{
\t public static function OnePage($cfg,$dir){
\t \t $tmplt_u = "<?php if(\$_REQUEST['type']==\"{TYPE}\"&&\$_REQUEST['src']==\"{SRC}\"){header(\"Content-Type: {CT}\"); ?>{DATA}<?php } ?>";
\t \t $tmplt_c = "<?php if(\$_REQUEST['all']==\"{TYPE}\"){header(\"Content-Type: {CT}\"); ?>{DATA}<?php } ?>";
\t \t $res = "<?php /* This code is generated by the OnePage tool. Find out more here: https://github.com/LeoWilson-XnD/lwilson_onepage */ ?>";
\t \t $dir.=$cfg['dir'];
\t \t if($cfg['v']==1){
\t \t \t foreach($cfg['unique'] as $ka => $va){
\t \t \t \t foreach($cfg[$ka] as $kb => $vb){
\t \t \t \t \t $u = $tmplt_u;
\t \t \t \t \t $u=str_replace("{TYPE}",explode("/",$ka)[1],$u);$u=str_replace("{SRC}",$kb,$u);$u=str_replace("{CT}",$ka,$u);$u=str_replace("{DATA}",file_get_contents($dir.$vb),$u);
\t \t \t \t \t $res.=$u;
\t \t \t \t }
\t \t \t }
\t \t \t foreach($cfg['combine'] as $ka => $va){
\t \t \t \t $ds = "";
\t \t \t \t foreach($cfg[$ka] as $kb => $vb){
\t \t \t \t \t $ds.=file_get_contents($dir.$vb);
\t \t \t \t }
\t \t \t \t $u = $tmplt_c;
\t \t \t \t $u=str_replace("{TYPE}",explode("/",$ka)[1],$u);$u=str_replace("{CT}",$ka,$u);$u=str_replace("{DATA}",file_get_contents($dir.$vb),$u);
\t \t \t \t $res.=$u;
\t \t \t }
\t \t \t foreach($cfg['links'] as $key => $val){
\t \t \t \t $res = str_replace($val,$key,$res);
\t \t \t }
\t \t }
\t \t return $res;
\t }
}
?>
composer.json
(パッケージのcomposer.json
ファイル):
{
"name": "lwilson/onepage",
"description": "This allows users to compile websites easily into one PHP file.",
"authors": [
{
"name": "Leo Wilson",
"email": "[email protected]",
\t \t \t "homepage": "https://xlww.net/",
\t \t \t "role": "Developer"
}
],
"minimum-stability": "stable",
\t "version": "v1.0.0",
\t "homepage": "https://github.com/LeoWilson-XnD/lwilson_onepage",
\t "licence":"GPL-3.0",
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"": "/"
}
}
}
私は何かを明らかに欠けている場合、私は事前にお詫び申し上げます。