在我的网站上添加API图形时遇到问题

时间:2011-03-24 20:12:55

标签: php php-extension

我遇到ChartDirector v.5 API

的问题

我将代码拖放到我的网站中。

当我转到特定页面时...它显示错误消息:

加载ChartDirector for PHP Extension时出错

已尝试动态加载ChartDirector,但未成功。有关PHP文档的信息,请参阅ChartDirector,或单击此处了解如何解决问题。

错误记录

Trying to load "phpchartdir530.dll" from the PHP extension directory "c:/wamp/bin/php/php5.3.5/ext/".
Fatal error: Call to undefined function dl() in C:\wamp\www\OrdiDepot\application\views\phpchartdir.php on line 44 
Call Stack: 0.0018 378216 
1. {main}() C:\wamp\www\OrdiDepot\index.php:0 0.0036 427824 
2. require_once('C:\wamp\www\OrdiDepot\system\codeigniter\CodeIgniter.php') C:\wamp\www\OrdiDepot\index.php:115 0.0329 1386232 
3. call_user_func_array() C:\wamp\www\OrdiDepot\system\codeigniter\CodeIgniter.php:236 0.0329 1386280 
4. ordiDepot->apropos() C:\wamp\www\OrdiDepot\system\codeigniter\CodeIgniter.php:0 0.0344 1392432 
5. CI_Loader->view() C:\wamp\www\OrdiDepot\application\controllers\ordiDepot.php:64 0.0344 1393128 
6. CI_Loader->_ci_load() C:\wamp\www\OrdiDepot\system\libraries\Loader.php:307 0.0354 1452168 
7. include('C:\wamp\www\OrdiDepot\application\views\apropos.php') C:\wamp\www\OrdiDepot\system\libraries\Loader.php:677 0.0537 3934888 
8. require_once('C:\wamp\www\OrdiDepot\application\views\phpchartdir.php') C:\wamp\www\OrdiDepot\application\views\apropos.php:49 0.0538 3980304 
9. cdLoadDLL() C:\wamp\www\OrdiDepot\application\views\phpchartdir.php:174 

对于require_once文件..我把它放在与我的视图相同的目录中(我使用的是MVC模型)

这是我的代码:

<div class="center_content">
   <div class="center_title_bar">À propos</div>
     <div class="prod_box_big">
        <div class="top_prod_box_big"></div>
        <div class="center_prod_box_big">            
                 <div class="details_big_box">
                    <div class = "info_compagnie">
    L’entreprise OrdiDépôt Inc. est une PME de Montréal qui 
    a été créée en 2010. Elle œuvre dans le domaine de l’informatique 
    et le divertissement  PC.  OrdiDépôt Inc. est une compagnie de 
    vente de matériel dans ces domaines. Nous offrons :   pièces 
   d’ordinateurs, systèmes complets et Jeux PC.
</div>
<div class = "graphic">
<?php
    require_once('phpchartdir.php');

    # The data for the pie chart
    $data = array(25, 18, 15, 12, 8, 30, 35);

        # The labels for the pie chart
    $labels = array("Labor", "Licenses", "Taxes", "Legal", "Insurance", "Facilities",
                                "Production");

                            # Create a PieChart object of size 450 x 270 pixels
                            $c = new PieChart(450, 270);

                            # Set the center of the pie at (150, 100) and the radius to 80 pixels
                            $c->setPieSize(150, 135, 100);

                            # add a legend box where the top left corner is at (330, 50)
                            $c->addLegend(330, 60);

                            # modify the sector label format to show percentages only
                            $c->setLabelFormat("{percent}%");

                            # Set the pie data and the pie labels
                            $c->setData($data, $labels);

                            # Use rounded edge shading, with a 1 pixel white (FFFFFF) border
                            $c->setSectorStyle(RoundedEdgeShading, 0xffffff, 1);

                            # Output the chart
                            header("Content-type: image/png");
                            print($c->makeChart2(PNG));
                        ?>
                    </div>
                 </div>                        
        </div>
       <div class="bottom_prod_box_big"></div>                                
     </div>
   </div>     <!-- end of center content -->  

感谢所有

1 个答案:

答案 0 :(得分:0)

看起来代码试图调用dl来在运行时动态加载扩展。自5.3起,dl已从PHP 删除

如果您需要加载扩展程序,则需要修改php.ini文件。在php.ini文件中查找扩展列表,并将其添加到那里。它看起来像ChartDirector has basic instructions for doing so

您可能希望考虑其他产品。 The ChartDirector installation documents似乎是为PHP4编写的,这通常是一个不好的信号:

  

适用于Windows的PHP ChartDirector至少需要PHP版本4.0.4pl1,并且已经过PHP Ver 4.3.4(截至本文档发布之日的最新PHP版本)的测试。