Tag Archives: thinkphp

[Solved] tp6.0 open_basedir Error: Warning: require(): open_basedir restriction in effect.

Error message

Warning: require(): open_basedir restriction in effect. File(/work/tp6/vendor/autoload.php) is not within the allowed path(s): (/work/tp6/public/:/tmp/) in /work/tp6/public/index.php on line 15

Warning: require(/work/tp6/vendor/autoload.php): failed to open stream: Operation not permitted in /work/tp6/public/index.php on line 15

Fatal error: require(): Failed opening required '/work/tp6/public/../vendor/autoload.php' (include_path='.:') in /work/tp6/public/index.php on line 15

 

Check the problem description and data, and find that it is the problem of PHP open_basedir  configuration is that PHP cannot import the files above the authorized directory;

In general, this problem will not occur. The reason for this problem is mostly due to the server. This restriction is made for security!

If the entry file of is switched to public, the following file should be modified to remove public

Solution:

Error reported by thinkphp5 and wdatepicker calendar control

Error reported by thinkphp5 and wdatepicker calendar control

The solution is as follows

{literal}
	<input type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'logmax\')||\'%y-%M-%d\'}'})" id="logmin" class="input-text Wdate" style="width:120px;">
	<input type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'logmin\')}',maxDate:'%y-%M-%d'})" id="logmax" class="input-text Wdate" style="width:120px;">
{/literal}

ThinkPHP uses literal to prevent template tags from being parsed

The installation of ThinkPHP reported an error. Could not find package topthink / think with stability stable

Install ThinkPHP and execute the command

composer create-project topthink/think tp5 --prefer-dist

report errors

 [InvalidArgumentException]
Could not find package topthink/think with stability stable.

resolvent:

    delete the previous image

    composer config -g --unset repos.packagist
    
      run the install ThinkPHP command

      composer create-project topthink/think tp5 --prefer-dist
      

      success!!!

[Solved] Fatal error: Class ‘think\Container‘ not found & [InvalidArgumentException] Could not find package

Fatal error: class’ think \ container ‘not found. This error means that the ThinkPHP core framework warehouse is not a branch of version 5.1, so the container of version 5.1 is not found;

The solution is to execute the following command on the terminal terminal of the IDE:

composer create-project topthink/think tp 5.1.35

Starting from tp5.1, the official website no longer provides a full version download, but can only be installed through the composer method.

[invalidargumentexception] could not find package. This error means that the installation package of the corresponding version is not found. The problem in the figure below is that the version number behind 5.1 is missing. It is correct after supplement as shown in the figure above.

  The program operation after correct input is as follows:

[Solved] PhpSpreadsheet Error: Invalid cell coordinate [1

When TP5 uses phpspreadsheet, if the number of columns exceeds 26, it will report an error. The specific solutions are as follows: it is easy to use by personal test

//Write to the table header section to read
  // Set the table header
  // $head formatted as ['Name', 'Phone', 'Contact']
        $colum = 'A';
        foreach ($head as $v) {
            $sheet->setCellValue($colum . '1', $v);
            $sheet->getColumnDimension($colum)->setWidth(20);
            $colum++;
        }
        //Write content to read
          $column = 2;
        foreach ($data as $key => $rows) {
            $span = 'A';
            // Column Write
            foreach ($rows as $keyName => $value) {
                $sheet->setCellValue($span . $column, $value);
                $span++;
            }
            $column++;
        }